diff options
Diffstat (limited to 'lib/libpthread/thread/thr_sleep.c')
-rw-r--r-- | lib/libpthread/thread/thr_sleep.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_sleep.c b/lib/libpthread/thread/thr_sleep.c index 7547e60..682c764 100644 --- a/lib/libpthread/thread/thr_sleep.c +++ b/lib/libpthread/thread/thr_sleep.c @@ -33,9 +33,11 @@ #include <pthread.h> #include "thr_private.h" -extern unsigned int __sleep(unsigned int); +extern unsigned int __sleep(unsigned int); +extern int __usleep(useconds_t); __weak_reference(_sleep, sleep); +__weak_reference(_usleep, usleep); unsigned int _sleep(unsigned int seconds) @@ -49,3 +51,16 @@ _sleep(unsigned int seconds) return (ret); } + +int +_usleep(useconds_t useconds) +{ + struct pthread *curthread = _get_curthread(); + unsigned int ret; + + _thr_cancel_enter(curthread); + ret = __usleep(useconds); + _thr_cancel_leave(curthread, 1); + + return (ret); +} |