summaryrefslogtreecommitdiff
path: root/cancel.c
diff options
context:
space:
mode:
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;