File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ namespace pthread_private {
3939 __thread void * tsd[tsd_nkeys];
4040 __thread pthread_t current_pthread;
4141 __thread int cancel_state = PTHREAD_CANCEL_ENABLE;
42+ __thread int cancel_type = PTHREAD_CANCEL_DEFERRED;
4243
4344 // NOTE: currently, the list of keys and destructor for each is global,
4445 // not per shared object or ELF namespace. So if a shared object uses
@@ -736,9 +737,16 @@ int pthread_setcancelstate(int state, int *oldstate)
736737 return 0 ;
737738}
738739
739- int pthread_setcanceltype (int state , int *oldstate )
740+ int pthread_setcanceltype (int type , int *oldtype )
740741{
741- WARN_STUBBED ();
742+ if (type != PTHREAD_CANCEL_ASYNCHRONOUS &&
743+ type != PTHREAD_CANCEL_DEFERRED) {
744+ return EINVAL;
745+ }
746+ if (oldtype) {
747+ (*oldtype) = cancel_type;
748+ }
749+ cancel_type = type;
742750 return 0 ;
743751}
744752
You can’t perform that action at this time.
0 commit comments