blob: 7d63a70221e786027f2d0f9f85c82f80f4ab2088 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/* Linuxthreads - a simple clone()-based implementation of Posix */
2/* threads for Linux. */
3/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
4/* */
5/* This program is free software; you can redistribute it and/or */
6/* modify it under the terms of the GNU Library General Public License */
7/* as published by the Free Software Foundation; either version 2 */
8/* of the License, or (at your option) any later version. */
9/* */
10/* This program is distributed in the hope that it will be useful, */
11/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13/* GNU Library General Public License for more details. */
14
15#include <signal.h>
16#include <sys/syscall.h>
17#define __ASSUME_REALTIME_SIGNALS defined(__NR_rt_sigaction)
18
19/* Primitives for controlling thread execution */
20
21static __inline__ void restart(pthread_descr th)
22{
23 /* See pthread.c */
24#if __ASSUME_REALTIME_SIGNALS
25 __pthread_restart_new(th);
26#else
27 __pthread_restart(th);
28#endif
29}
30
31static __inline__ void suspend(pthread_descr self)
32{
33 /* See pthread.c */
34#if __ASSUME_REALTIME_SIGNALS
35 __pthread_wait_for_restart_signal(self);
36#else
37 __pthread_suspend(self);
38#endif
39}
40
41static __inline__ int timedsuspend(pthread_descr self,
42 const struct timespec *abstime)
43{
44 /* See pthread.c */
45#if __ASSUME_REALTIME_SIGNALS
46 return __pthread_timedsuspend_new(self, abstime);
47#else
48 return __pthread_timedsuspend(self, abstime);
49#endif
50}