diff options
Diffstat (limited to 'ACE/ace/Thread_Adapter.cpp')
-rw-r--r-- | ACE/ace/Thread_Adapter.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ACE/ace/Thread_Adapter.cpp b/ACE/ace/Thread_Adapter.cpp index a8e560b35e1..7f2634f5826 100644 --- a/ACE/ace/Thread_Adapter.cpp +++ b/ACE/ace/Thread_Adapter.cpp @@ -22,6 +22,7 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, , ACE_SEH_EXCEPT_HANDLER selector, ACE_SEH_EXCEPT_HANDLER handler #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , long cancel_flags ) : ACE_Base_Thread_Adapter ( user_func @@ -32,6 +33,7 @@ ACE_Thread_Adapter::ACE_Thread_Adapter (ACE_THR_FUNC user_func, , selector , handler #endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */ + , cancel_flags ) , thr_mgr_ (tm) { @@ -105,6 +107,9 @@ ACE_Thread_Adapter::invoke_i (void) ACE_OS_Thread_Descriptor *thr_desc = this->thr_desc_; #endif /* ACE_WIN32 && ACE_HAS_MFC && (ACE_HAS_MFC != 0) */ + // Pick up the cancel-related flags before deleting this. + long cancel_flags = this->flags_; + // Delete ourselves since we don't need <this> anymore. Make sure // not to access <this> anywhere below this point. delete this; @@ -125,6 +130,17 @@ ACE_Thread_Adapter::invoke_i (void) ACE_OS::thr_setprio (prio); #endif /* ACE_NEEDS_LWP_PRIO_SET */ + if (cancel_flags != 0) + { + // If both flags are set, ignore this. + int old = 0; + int val = cancel_flags & (THR_CANCEL_ENABLE | THR_CANCEL_DISABLE); + if (val == THR_CANCEL_ENABLE || val == THR_CANCEL_DISABLE) + ACE_OS::thr_setcancelstate (val, &old); + val = cancel_flags & (THR_CANCEL_DEFERRED | THR_CANCEL_ASYNCHRONOUS); + if (val == THR_CANCEL_DEFERRED || val == THR_CANCEL_ASYNCHRONOUS) + ACE_OS::thr_setcanceltype (val, &old); + } ACE_THR_FUNC_RETURN status = 0; |