From 588b7f6616834651ea4062cf440e57a8a0cba25f Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 30 Oct 1999 09:17:28 +0000 Subject: ./ChangeLog: 1999-10-30 Ross Johnson * create.c (pthread_create): Explicitly initialise thread state to default values. * cancel.c (pthread_setcancelstate): Check for NULL 'oldstate' for compatibility with Solaris pthreads; (pthread_setcanceltype): ditto: - Erik Hensema 1999-10-23 Ross Johnson * pthread.h (ctime_r): Fix incorrect argument "_tm" - Erik Hensema tests/ChangeLog: 1999-10-30 Ross Johnson * cancel1.c: New. Test pthread_setcancelstate and pthread_setcanceltype functions. * eyal1.c (waste_time): Change calculation to avoid FP exception on Aplhas - Rich Peters --- cancel.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'cancel.c') diff --git a/cancel.c b/cancel.c index c3711e2..a5d923d 100644 --- a/cancel.c +++ b/cancel.c @@ -50,12 +50,16 @@ pthread_setcancelstate (int state, int *oldstate) * This function atomically sets the calling thread's * cancelability state to 'state' and returns the previous * cancelability state at the location referenced by - * 'oldstate' + * 'oldstate'. * * NOTES: * 1) Use to disable cancellation around 'atomic' code that * includes cancellation points * + * COMPATIBILITY ADDITIONS + * If 'oldstate' is NULL then the previous state is not returned + * but the function still succeeds. (Solaris) + * * RESULTS * 0 successfully set cancelability type, * EINVAL 'state' is invalid @@ -71,7 +75,11 @@ pthread_setcancelstate (int state, int *oldstate) state == PTHREAD_CANCEL_DISABLE)) { - *oldstate = self->cancelState; + if (oldstate != NULL) + { + *oldstate = self->cancelState; + } + self->cancelState = state; result = 0; @@ -116,6 +124,10 @@ pthread_setcanceltype (int type, int *oldtype) * 1) Use with caution; most code is not safe for use * with asynchronous cancelability. * + * COMPATIBILITY ADDITIONS + * If 'oldtype' is NULL then the previous type is not returned + * but the function still succeeds. (Solaris) + * * RESULTS * 0 successfully set cancelability type, * EINVAL 'type' is invalid @@ -131,7 +143,11 @@ pthread_setcanceltype (int type, int *oldtype) type == PTHREAD_CANCEL_ASYNCHRONOUS)) { - *oldtype = self->cancelType; + if (oldtype != NULL) + { + *oldtype = self->cancelType; + } + self->cancelType = type; result = 0; -- cgit v1.2.3