restart.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* 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. #include <signal.h>
  15. #include <bits/kernel-features.h>
  16. /* Primitives for controlling thread execution */
  17. static __inline__ void restart(pthread_descr th)
  18. {
  19. /* See pthread.c */
  20. #if __ASSUME_REALTIME_SIGNALS
  21. __pthread_restart_new(th);
  22. #else
  23. __pthread_restart(th);
  24. #endif
  25. }
  26. static __inline__ void suspend(pthread_descr self)
  27. {
  28. /* See pthread.c */
  29. #if __ASSUME_REALTIME_SIGNALS
  30. __pthread_wait_for_restart_signal(self);
  31. #else
  32. __pthread_suspend(self);
  33. #endif
  34. }
  35. static __inline__ int timedsuspend(pthread_descr self,
  36. const struct timespec *abstime)
  37. {
  38. /* See pthread.c */
  39. #if __ASSUME_REALTIME_SIGNALS
  40. return __pthread_timedsuspend_new(self, abstime);
  41. #else
  42. return __pthread_timedsuspend(self, abstime);
  43. #endif
  44. }