summaryrefslogtreecommitdiff
path: root/cancel.c
diff options
context:
space:
mode:
authorrpj <rpj>1999-10-30 09:17:28 +0000
committerrpj <rpj>1999-10-30 09:17:28 +0000
commit588b7f6616834651ea4062cf440e57a8a0cba25f (patch)
tree52851833a18a06ffadcca2e1c9dac08e9ec30d9a /cancel.c
parent9d592dbd51949858e2e787d16476420f10d2c9a5 (diff)
./ChangeLog:
1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * 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 <erik.hensema@group2000.nl> 1999-10-23 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * pthread.h (ctime_r): Fix incorrect argument "_tm" - Erik Hensema <erik.hensema@group2000.nl> tests/ChangeLog: 1999-10-30 Ross Johnson <rpj@ixobrychus.canberra.edu.au> * cancel1.c: New. Test pthread_setcancelstate and pthread_setcanceltype functions. * eyal1.c (waste_time): Change calculation to avoid FP exception on Aplhas - Rich Peters <rpeters@micro-magic.com>
Diffstat (limited to 'cancel.c')
-rw-r--r--cancel.c22
1 files changed, 19 insertions, 3 deletions
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;