Add a cancellation point for usleep().
This commit is contained in:
parent
761a1339b8
commit
c0c21f6ca7
@ -33,9 +33,11 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "thr_private.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(_sleep, sleep);
|
||||||
|
__weak_reference(_usleep, usleep);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
_sleep(unsigned int seconds)
|
_sleep(unsigned int seconds)
|
||||||
@ -49,3 +51,16 @@ _sleep(unsigned int seconds)
|
|||||||
|
|
||||||
return (ret);
|
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);
|
||||||
|
}
|
||||||
|
@ -33,9 +33,11 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "thr_private.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(_sleep, sleep);
|
||||||
|
__weak_reference(_usleep, usleep);
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
_sleep(unsigned int seconds)
|
_sleep(unsigned int seconds)
|
||||||
@ -49,3 +51,16 @@ _sleep(unsigned int seconds)
|
|||||||
|
|
||||||
return (ret);
|
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);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user