summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2005-10-08 17:57:49 +0000
committerXin LI <delphij@FreeBSD.org>2005-10-08 17:57:49 +0000
commit569c4357be8e739482ce69197b2d0e68b1e6a2ee (patch)
treed831b8befd8c68fc168e31d69968677d09f1fe1d /lib
parentfb060d5d7f696e63fbaef6ad80a962e0f37464ea (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libpthread/thread/thr_sleep.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_sleep.c b/lib/libpthread/thread/thr_sleep.c
index 7547e60674a1..682c76403213 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);
+}