diff options
author | rpj <rpj> | 1999-01-18 23:50:07 +0000 |
---|---|---|
committer | rpj <rpj> | 1999-01-18 23:50:07 +0000 |
commit | 20f77eda55f874b939719ac0abda4405ecd20bf8 (patch) | |
tree | e81393914f1a89d055b2384cc1c612d48c4a2a2c /misc.c | |
parent | 9b75468a10363ada39a17563cca6bcd819ec8fcd (diff) |
Tue Jan 19 18:27:42 1999 Ross Johnson <rpj@swan.canberra.edu.au>
* pthread.h (pthreadCancelableTimedWait): New prototype.
(pthreadCancelableWait): Remove second argument.
* misc.c (CancelableWait): New static function is
pthreadCancelableWait() renamed.
(pthreadCancelableWait): Now just calls CancelableWait() with
INFINITE timeout.
(pthreadCancelableTimedWait): Just calls CancelableWait()
with passed in timeout.
* private.c (_pthread_sem_timedwait): 'abstime' arg really is
absolute time. Calculate relative time to wait from current
time before passing timeout to new routine
pthreadCancelableTimedWait().
- Scott Lightner <scott@curriculum.com>
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 25 |
1 files changed, 19 insertions, 6 deletions
@@ -129,8 +129,8 @@ pthread_equal (pthread_t t1, pthread_t t2) } /* pthread_equal */ -int -pthreadCancelableWait (HANDLE waitHandle, DWORD abstime) +static int +CancelableWait (HANDLE waitHandle, DWORD timeout) /* * ------------------------------------------------------------------- * This provides an extra hook into the pthread_cancel @@ -151,7 +151,6 @@ pthreadCancelableWait (HANDLE waitHandle, DWORD abstime) DWORD nHandles = 1; DWORD status; - handles[0] = waitHandle; if ((self = pthread_getspecific (_pthread_selfThreadKey)) != NULL) @@ -177,7 +176,7 @@ pthreadCancelableWait (HANDLE waitHandle, DWORD abstime) nHandles, handles, FALSE, - abstime); + timeout); if (status == WAIT_FAILED) @@ -185,10 +184,13 @@ pthreadCancelableWait (HANDLE waitHandle, DWORD abstime) result = EINVAL; } - else if (status == WAIT_ABANDONED_0) + else if (status == WAIT_TIMEOUT) { result = ETIMEDOUT; - + } + else if (status == WAIT_ABANDONED_0) + { + result = EINVAL; } else { @@ -243,6 +245,17 @@ pthreadCancelableWait (HANDLE waitHandle, DWORD abstime) } /* pthreadCancelableWait */ +int +pthreadCancelableWait (HANDLE waitHandle) +{ + return (CancelableWait(waitHandle, INFINITE)); +} + +int +pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout) +{ + return (CancelableWait(waitHandle, timeout)); +} /* </JEB> */ |