diff options
author | nw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-21 06:17:53 +0000 |
---|---|---|
committer | nw1 <nw1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-11-21 06:17:53 +0000 |
commit | da0c764e47e5d772e650f8f6b1708a24d3550d9e (patch) | |
tree | 3ae939b989ca53856f3e95f8dec3780a75da2ddc | |
parent | 26a2cb0601deecdf8c66f689ed3b4b6b5efe5428 (diff) | |
download | ATCD-da0c764e47e5d772e650f8f6b1708a24d3550d9e.tar.gz |
Changed to allow ENOTSUP error in thr functions. Moved errno perserving codes.
-rw-r--r-- | ace/Thread_Manager.cpp | 30 | ||||
-rw-r--r-- | ace/Thread_Manager.h | 10 |
2 files changed, 26 insertions, 14 deletions
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp index 748a193f8db..26aadc64f7e 100644 --- a/ace/Thread_Manager.cpp +++ b/ace/Thread_Manager.cpp @@ -848,13 +848,11 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int arg) if (result != 0) { - // We need to save this across calls to remove_thr() since that - // call may reset errno. - int error = errno; - - this->thr_to_be_removed_.enqueue_tail (td); + // Only remove a thread from us when there is a + // "real" error. + if (errno != ENOTSUP) + this->thr_to_be_removed_.enqueue_tail (td); - errno = error; return -1; } else @@ -868,11 +866,13 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int arg) ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); \ ACE_FIND (this->find_thread (t_id), ptr); \ int result = OP (ptr); \ + int error = errno; \ while (! this->thr_to_be_removed_.is_empty ()) { \ ACE_Thread_Descriptor *td; \ this->thr_to_be_removed_.dequeue_head (td); \ this->remove_thr (td); \ } \ + errno = error; \ return result // Suspend a single thread. @@ -913,11 +913,13 @@ ACE_Thread_Manager::kill (ACE_thread_t t_id, int signum) ACE_FIND (this->find_thread (t_id), ptr); int result = this->kill_thr (ptr, signum); + int error = errno; while (! this->thr_to_be_removed_.is_empty ()) { ACE_Thread_Descriptor *td; this->thr_to_be_removed_.dequeue_head (td); this->remove_thr (td); } + errno = error; return result; } @@ -1008,7 +1010,7 @@ ACE_Thread_Manager::apply_grp (int grp_id, int arg) { ACE_TRACE ("ACE_Thread_Manager::apply_grp"); - ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1)); + ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_monx, this->lock_, -1)); ACE_ASSERT (this->thr_to_be_removed_.is_empty ()); int result = 0; @@ -1025,9 +1027,12 @@ ACE_Thread_Manager::apply_grp (int grp_id, if (! this->thr_to_be_removed_.is_empty ()) { + // Preserve errno! + int error = errno; ACE_Thread_Descriptor *td; while (this->thr_to_be_removed_.dequeue_head (td) != -1) this->remove_thr (td); + errno = error; } return result; @@ -1091,9 +1096,12 @@ ACE_Thread_Manager::apply_all (ACE_THR_MEMBER_FUNC func, int arg) if (! this->thr_to_be_removed_.is_empty ()) { + // Preserve errno! + int error = errno; ACE_Thread_Descriptor *td; while (this->thr_to_be_removed_.dequeue_head (td) != -1) this->remove_thr (td); + errno = error; } return result; @@ -1319,9 +1327,12 @@ ACE_Thread_Manager::apply_task (ACE_Task_Base *task, if (! this->thr_to_be_removed_.is_empty ()) { + // Preserve errno! + int error = errno; ACE_Thread_Descriptor *td; while (this->thr_to_be_removed_.dequeue_head (td) != -1) this->remove_thr (td); + errno = error; } return result; @@ -1350,8 +1361,9 @@ ACE_Thread_Manager::wait_task (ACE_Task_Base *task) iter.advance ()) // If threads are created as THR_DETACHED or THR_DAEMON, we can't help much here. if (iter.next ()->task_ == task && - (((iter.next ()->flags_ & (THR_DETACHED | THR_DAEMON)) == 0) - || ((iter.next ()->flags_ & THR_JOINABLE) != 0))) + (ACE_BIT_DISABLED (iter.next ()->flags_, + (THR_DETACHED | THR_DAEMON))) + || ACE_BIT_ENABLED (iter.next ()->flags_, THR_JOINABLE)) copy_table[copy_count++] = *iter.next (); } diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h index 6f92fe8793f..40f30070334 100644 --- a/ace/Thread_Manager.h +++ b/ace/Thread_Manager.h @@ -443,25 +443,25 @@ protected: int apply_task (ACE_Task_Base *task, ACE_THR_MEMBER_FUNC, int = 0); // Apply <func> to all members of the table that match the <task> - int apply_grp (int grp_id, ACE_THR_MEMBER_FUNC, int = 0); + int apply_grp (int grp_id, ACE_THR_MEMBER_FUNC func, int arg = 0); // Apply <func> to all members of the table that match the <grp_id>. int apply_all (ACE_THR_MEMBER_FUNC, int = 0); // Apply <func> to all members of the table. - int join_thr (ACE_Thread_Descriptor *td, int nouse = 0); + int join_thr (ACE_Thread_Descriptor *td, int microsoft_sucks = 0); // Join the thread described in <tda>. - int resume_thr (ACE_Thread_Descriptor *td, int nouse = 0); + int resume_thr (ACE_Thread_Descriptor *td, int microsoft_sucks = 0); // Resume the thread described in <tda>. - int suspend_thr (ACE_Thread_Descriptor *td, int nouse = 0); + int suspend_thr (ACE_Thread_Descriptor *td, int microsoft_sucks = 0); // Suspend the thread described in <tda>. int kill_thr (ACE_Thread_Descriptor *td, int signum); // Send signal <signum> to the thread described in <tda>. - int cancel_thr (ACE_Thread_Descriptor *td, int nouse = 0); + int cancel_thr (ACE_Thread_Descriptor *td, int microsoft_sucks = 0); // Set the cancellation flag for the thread described in <tda>. ACE_Double_Linked_List<ACE_Thread_Descriptor> thr_list_; |