From f70f9fc4e675ab97bfaae81e7a92cb68993a2a79 Mon Sep 17 00:00:00 2001 From: nanbor Date: Tue, 13 May 2003 00:35:45 +0000 Subject: ChangeLogTag:Mon May 12 19:27:54 2003 Nanbor Wang --- ChangeLog | 14 ++++++++++++++ ace/Thread_Manager.cpp | 36 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1dc7c705afc..d67d28bdae6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Mon May 12 19:27:54 2003 Nanbor Wang + + * ace/Thread_Manager.cpp (wait): Fixed an occasional assertion + failure during shutdown of our servers which seems be caused by + a double deletion of an item in the ACE_Thread_Manager + terminated_thr_list_ in ACE_Thread_Manager::wait (). + + The statement "item = this->terminated_thr_list_.delete_head ()" + is not protected by the mutex and can be access by + more than one thread modifying the terminated_thr_list_. + Extending the mutex protection scope fixed this problem. + Thanks to Bruce McIntosh for + suggesting the fix. [Bug 1505] + Mon May 12 13:32:56 2003 Chad Elliott * bin/MakeProjectCreator/modules/ProjectCreator.pm: diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index 836fbe827ef..252ca9fb7b3 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -1755,37 +1755,37 @@ ACE_Thread_Manager::wait (const ACE_Time_Value *timeout, // Program is shutting down, no chance to wait on threads. // Therefore, we'll just remove threads from the list. this->remove_thr_all (); - // Release the guard, giving other threads a chance to run. - } #if !defined (VXWORKS) - // @@ VxWorks doesn't support thr_join (yet.) We are working - //on our implementation. Chorus'es thr_join seems broken. - ACE_Thread_Descriptor_Base *item; + // @@ VxWorks doesn't support thr_join (yet.) We are working + //on our implementation. Chorus'es thr_join seems broken. + ACE_Thread_Descriptor_Base *item; #if defined (CHORUS) - if (ACE_Object_Manager::shutting_down () != 1) - { + if (ACE_Object_Manager::shutting_down () != 1) + { #endif /* CHORUS */ - while ((item = this->terminated_thr_list_.delete_head ()) != 0) - { - if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON) - || ACE_BIT_ENABLED (item->flags_, THR_JOINABLE)) - // Detached handles shouldn't reached here. + while ((item = this->terminated_thr_list_.delete_head ()) != 0) + { + if (ACE_BIT_DISABLED (item->flags_, THR_DETACHED | THR_DAEMON) + || ACE_BIT_ENABLED (item->flags_, THR_JOINABLE)) + // Detached handles shouldn't reached here. ACE_Thread::join (item->thr_handle_); # if defined (ACE_HAS_PTHREADS_DRAFT4) && defined (ACE_LACKS_SETDETACH) - // Must explicitly detach threads. Threads without - // THR_DETACHED were detached in ACE_OS::thr_create (). - ::pthread_detach (&item->thr_handle_); + // Must explicitly detach threads. Threads without + // THR_DETACHED were detached in ACE_OS::thr_create (). + ::pthread_detach (&item->thr_handle_); # endif /* ACE_HAS_PTHREADS_DRAFT4 && ACE_LACKS_SETDETACH */ - delete item; - } + delete item; + } #if defined (CHORUS) - } + } #endif /* CHORUS */ #endif /* ! VXWORKS */ + // Release the guard, giving other threads a chance to run. + } #else ACE_UNUSED_ARG (timeout); ACE_UNUSED_ARG (abandon_detached_threads); -- cgit v1.2.1