Back to index

glibc  2.9
restart.h
Go to the documentation of this file.
00001 /* Linuxthreads - a simple clone()-based implementation of Posix        */
00002 /* threads for Linux.                                                   */
00003 /* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr)              */
00004 /*                                                                      */
00005 /* This program is free software; you can redistribute it and/or        */
00006 /* modify it under the terms of the GNU Library General Public License  */
00007 /* as published by the Free Software Foundation; either version 2       */
00008 /* of the License, or (at your option) any later version.               */
00009 /*                                                                      */
00010 /* This program is distributed in the hope that it will be useful,      */
00011 /* but WITHOUT ANY WARRANTY; without even the implied warranty of       */
00012 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        */
00013 /* GNU Library General Public License for more details.                 */
00014 
00015 #include <signal.h>
00016 #include <kernel-features.h>
00017 
00018 /* Primitives for controlling thread execution */
00019 
00020 static inline void restart(pthread_descr th)
00021 {
00022   /* See pthread.c */
00023 #if __ASSUME_REALTIME_SIGNALS
00024   __pthread_restart_new(th);
00025 #else
00026   __pthread_restart(th);
00027 #endif
00028 }
00029 
00030 static inline void suspend(pthread_descr self)
00031 {
00032   /* See pthread.c */
00033 #if __ASSUME_REALTIME_SIGNALS
00034   __pthread_wait_for_restart_signal(self);
00035 #else
00036   __pthread_suspend(self);
00037 #endif
00038 }
00039 
00040 static inline int timedsuspend(pthread_descr self,
00041               const struct timespec *abstime)
00042 {
00043   /* See pthread.c */
00044 #if __ASSUME_REALTIME_SIGNALS
00045   return __pthread_timedsuspend_new(self, abstime);
00046 #else
00047   return __pthread_timedsuspend(self, abstime);
00048 #endif
00049 }