diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 09:15:04 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-22 16:57:25 +0200 |
commit | 47ac81f645aba2fba985fa991f532173e6dd5b78 (patch) | |
tree | 53b48f45318df093ce21aa79ceaaf4e797443511 /cpukit/posix/src/setcanceltype.c | |
parent | sptests/sp37: Disable dispatch for clock tick (diff) | |
download | rtems-47ac81f645aba2fba985fa991f532173e6dd5b78.tar.bz2 |
posix: Obtain _Thread_Executing in proper context
Diffstat (limited to 'cpukit/posix/src/setcanceltype.c')
-rw-r--r-- | cpukit/posix/src/setcanceltype.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cpukit/posix/src/setcanceltype.c b/cpukit/posix/src/setcanceltype.c index f97affa8fb..9398c22cea 100644 --- a/cpukit/posix/src/setcanceltype.c +++ b/cpukit/posix/src/setcanceltype.c @@ -39,6 +39,7 @@ int pthread_setcanceltype( ) { POSIX_API_Control *thread_support; + Thread_Control *executing; /* * Don't even think about deleting a resource from an ISR. @@ -55,13 +56,15 @@ int pthread_setcanceltype( if ( type != PTHREAD_CANCEL_DEFERRED && type != PTHREAD_CANCEL_ASYNCHRONOUS ) return EINVAL; - thread_support = _Thread_Executing->API_Extensions[ THREAD_API_POSIX ]; - _Thread_Disable_dispatch(); + + executing = _Thread_Executing; + thread_support = executing ->API_Extensions[ THREAD_API_POSIX ]; + *oldtype = thread_support->cancelability_type; thread_support->cancelability_type = type; - _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch(_Thread_Executing); + _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch( executing ); /* * _Thread_Enable_dispatch is invoked by above call. |