diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-08 12:54:03 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2006-06-08 12:54:03 +0000 |
commit | 02af90ca70169e81c52c5f189cc18d1222437fd3 (patch) | |
tree | 05557ef47333fec556d7876069e171aa25bb1b5c | |
parent | 3a4d147c5926fee1779e4d5ff2c159582d06dfd7 (diff) | |
download | ATCD-02af90ca70169e81c52c5f189cc18d1222437fd3.tar.gz |
ChangeLogTag:Thu
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ace/OS_NS_Thread.inl | 21 |
2 files changed, 16 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index 4c7ae40001a..f350da9d5bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 8 12:44:46 UTC 2006 Douglas C. Schmidt <schmidt@dre.vanderbilt.edu> + + * ace/OS_NS_Thread.inl (recursive_mutex_lock): Cleaned up the + structure of the code here so that we don't try to release the + nesting lock unless it was acquired successfully. Thanks to + J.T. for reporting this. + Thu Jun 8 12:37:12 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> * bin/MakeProjectCreator/config/corba_e_compact.mpb: diff --git a/ace/OS_NS_Thread.inl b/ace/OS_NS_Thread.inl index 4dc5e8033cb..675365afab2 100644 --- a/ace/OS_NS_Thread.inl +++ b/ace/OS_NS_Thread.inl @@ -798,7 +798,7 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m, ACE_thread_t t_id = ACE_OS::thr_self (); int result = 0; - // Acquire the guard. + // Try to acquire the guard. if (ACE_OS::thread_mutex_lock (&m->nesting_mutex_, timeout) == -1) result = -1; else @@ -819,15 +819,13 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m, &m->nesting_mutex_, const_cast <ACE_Time_Value *> (&timeout)); - // the mutex is reacquired even in the case of a timeout + // The mutex is reacquired even in the case of a timeout // release the mutex to prevent a deadlock if (result == -1) { - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - ACE_OS::thread_mutex_unlock (&m->nesting_mutex_); - } + // Save/restore errno. + ACE_Errno_Guard error (errno); + ACE_OS::thread_mutex_unlock (&m->nesting_mutex_); return result; } @@ -840,12 +838,11 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m, // At this point, we can safely increment the nesting_level_ no // matter how we got here! m->nesting_level_++; + + // Save/restore errno. + ACE_Errno_Guard error (errno); + ACE_OS::thread_mutex_unlock (&m->nesting_mutex_); } - { - // Save/restore errno. - ACE_Errno_Guard error (errno); - ACE_OS::thread_mutex_unlock (&m->nesting_mutex_); - } return result; #endif /* ACE_HAS_RECURSIVE_MUTEXES */ #else |