summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog-99b36
-rw-r--r--README1
-rw-r--r--TAO/ChangeLog-99c2
-rw-r--r--ace/ACE.cpp17
-rw-r--r--ace/Connector.cpp20
-rw-r--r--ace/Local_Tokens.cpp7
-rw-r--r--ace/Message_Queue_T.cpp9
-rw-r--r--ace/OS.cpp4
-rw-r--r--ace/OS.h46
-rw-r--r--ace/OS.i27
-rw-r--r--ace/Process_Manager.cpp7
-rw-r--r--ace/Remote_Tokens.cpp20
-rw-r--r--ace/SOCK_Acceptor.cpp7
-rw-r--r--ace/SOCK_Connector.cpp15
-rw-r--r--ace/Signal.cpp14
-rw-r--r--ace/Synch_T.cpp10
-rw-r--r--ace/Thread_Manager.cpp36
-rw-r--r--ace/Token_Collection.cpp11
18 files changed, 163 insertions, 126 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b
index 9c522d8f080..bed060f8a1a 100644
--- a/ChangeLog-99b
+++ b/ChangeLog-99b
@@ -1,27 +1,33 @@
+Tue Jun 8 15:47:06 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu>
+
+ * ace: Updated most of the places in ACE that can benefit from the
+ new ACE_Errno_Guard class.
+
+ * ace/OS.h: Added a new ACE_Errno_Guard class that improves
+ performance when thread-specific errno must be saved/restored in
+ a block of code. Thanks to Serge Kolgan <skolgan@cisco.com> for
+ motivating this.
+
+ * ace/Env_Value_T.h: Added a new ACE_Convert() function that works
+ for const char *'s. Thanks to David for reporting this.
+
Tue Jun 08 18:08:41 1999 Steve Huston <shuston@riverace.com>
* ace/OS.h: Added new overridable macro, ACE_LOCALHOST. This allows
overriding of the string used to do a loopback IP socket to the
local host. Some systems (e.g. PharLap ETS) don't have a host table
out of the box, and require an IP address string.
- * ace/Pipe.cpp: Use the new ACE_LOCALHOST macro instead of a hard
- "localhost" when using a socket to emulate a pipe.
- Thanks to Bruce Trask <BTRASK@contactsystems.com> for working to
- get this ironed out for PharLap ETS.
+ * ace/Pipe.cpp: Use the new ACE_LOCALHOST macro instead of a hard
+ "localhost" when using a socket to emulate a pipe. Thanks to
+ Bruce Trask <BTRASK@contactsystems.com> for working to get this
+ ironed out for PharLap ETS.
* README: Added Bruce Trask to the Hall of Fame ;-)
-Tue Jun 08 16:57:03 1999 Steve Huston <shuston@riverace.com>
-
- * tests/SOCK_Connector_Test.cpp: Check for failed host lookup before
- trying to connect. Changed the way sethostent is done on AIX 4.3 to
- work around an apparant bug in AIX 4.3.
-
-Tue Jun 8 15:47:06 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu>
-
- * ace/Env_Value_T.h: Added a new ACE_Convert() function that works
- for const char *'s. Thanks to David for reporting this.
+ * tests/SOCK_Connector_Test.cpp: Check for failed host lookup
+ before trying to connect. Changed the way sethostent is done on
+ AIX 4.3 to work around an apparent bug in AIX 4.3.
Tue Jun 08 13:46:38 1999 Nanbor Wang <nanbor@cs.wustl.edu>
@@ -64,7 +70,7 @@ Mon Jun 7 14:21:48 1999 Kirthika Parameswaran <kirthika@cs.wustl.edu>
* tests/DLL_Test.cpp (main): ANSI C++ spec doesnt allow void * to
be typecasted to a function_pointer. Hence made changes to
- remove the warning due to this. Thanks to Nanbor
+ remove the warning due to this. Thanks to Nanbor
<nanbor@cs.wustl.edu> for pointing it out.
Mon Jun 7 14:12:02 1999 Nanbor Wang <nanbor@cs.wustl.edu>
diff --git a/README b/README
index 262c50dcdf5..6a906a1824c 100644
--- a/README
+++ b/README
@@ -863,7 +863,6 @@ Eric S Rosenthal <esr@netcom.com>
Sridevi Subramanian <subrams@erols.com>
Bruce Trask <BTRASK@contactsystems.com>
-
I would particularly like to thank Paul Stephenson, who worked with me
at Ericsson and is now at ObjectSpace. Paul devised the recursive
Makefile scheme that underlies this distribution and also spent
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 73d7e7b83e8..ac5e6bd57c8 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -97,7 +97,7 @@ Tue Jun 8 17:12:24 1999 Vishal Kachroo <vishal@cs.wustl.edu>
* /orbsvcs/tests/Time/Client_i.h
* docs/Options.html : Updated the -ORBInitRef to include the
- fetype IOR.
+ filetype IOR.
Tue Jun 08 16:10:09 1999 David L. Levine <levine@cs.wustl.edu>
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 5b96172d8e6..b5f7d325e98 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -1222,16 +1222,14 @@ ACE::leave_recv_timedwait (ACE_HANDLE handle,
int val)
{
if (timeout != 0
- && ACE_BIT_DISABLED (val, ACE_NONBLOCK))
+ && ACE_BIT_DISABLED (val,
+ ACE_NONBLOCK))
{
- // We need to stash errno here because ACE::clr_flags() may
- // reset it.
- int error = errno;
-
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// Only disable ACE_NONBLOCK if we weren't in non-blocking mode
// originally.
ACE::clr_flags (handle, ACE_NONBLOCK);
- errno = error;
}
}
@@ -1304,14 +1302,11 @@ ACE::leave_send_timedwait (ACE_HANDLE handle,
if (timeout != 0
&& ACE_BIT_DISABLED (val, ACE_NONBLOCK))
{
- // We need to stash errno here because ACE::clr_flags() may
- // reset it.
- int error = errno;
-
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// Only disable ACE_NONBLOCK if we weren't in non-blocking mode
// originally.
ACE::clr_flags (handle, ACE_NONBLOCK);
- errno = error;
}
}
diff --git a/ace/Connector.cpp b/ace/Connector.cpp
index a0e12e99768..9761a204c1e 100644
--- a/ace/Connector.cpp
+++ b/ace/Connector.cpp
@@ -457,14 +457,11 @@ ACE_Connector<SH, PR_CO_2>::connect_i (SH *&sh,
}
else
{
- // Make sure to save/restore the errno since <close> may
- // change it.
-
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// Make sure to close down the Channel to avoid descriptor
// leaks.
new_sh->close (0);
- errno = error;
}
return -1;
}
@@ -535,7 +532,8 @@ template <class SH, PR_CO_1> int
ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh,
const ACE_Synch_Options &synch_options)
{
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
ACE_TRACE ("ACE_Connector<SH, PR_CO_2>::create_AST");
AST *ast;
@@ -569,18 +567,10 @@ ACE_Connector<SH, PR_CO_2>::create_AST (SH *sh,
goto fail3;
ast->cancellation_id (cancellation_id);
- // Reset this because something might have gone wrong
- // elsewhere...
- errno = error;
return 0;
}
else
- {
- // Reset this because something might have gone wrong
- // elsewhere...
- errno = error; // EWOULDBLOCK
- return 0; // Ok, everything worked just fine...
- }
+ return 0; // Ok, everything worked just fine...
}
// Undo previous actions using the ol' "goto label and fallthru"
diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp
index a6e359ef34b..a5c1260f0b8 100644
--- a/ace/Local_Tokens.cpp
+++ b/ace/Local_Tokens.cpp
@@ -1299,12 +1299,9 @@ ACE_Token_Proxy::handle_options (ACE_Synch_Options &options,
if (options[ACE_Synch_Options::USE_REACTOR] == 1)
// Asynchronous.
{
- int error = errno;
- // if (options[ACE_Synch_Options::USE_TIMEOUT] == 1)
- // ACE_ERROR_RETURN ((LM_ERROR, "Timeouts not yet supported" "
- // with asynchronous operations."), -1);
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
cv.mutex ().release ();
- errno = error;
ACE_RETURN (-1);
}
else
diff --git a/ace/Message_Queue_T.cpp b/ace/Message_Queue_T.cpp
index f1255f597a6..67e76992def 100644
--- a/ace/Message_Queue_T.cpp
+++ b/ace/Message_Queue_T.cpp
@@ -492,9 +492,10 @@ ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_full_cond (ACE_Guard<ACE_SYNCH_MUTEX_
result = this->not_full_cond_.acquire ();
else
result = this->not_full_cond_.acquire (*timeout);
- int error = errno;
+
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
mon.acquire ();
- errno = error;
}
#else
ACE_UNUSED_ARG (mon);
@@ -540,9 +541,9 @@ ACE_Message_Queue<ACE_SYNCH_USE>::wait_not_empty_cond (ACE_Guard<ACE_SYNCH_MUTEX
if (result == -1 && errno == ETIME)
errno = EWOULDBLOCK;
}
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
mon.acquire ();
- errno = error;
}
#else
ACE_UNUSED_ARG (mon);
diff --git a/ace/OS.cpp b/ace/OS.cpp
index 425bcad3dbf..7b3879769f4 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -5244,12 +5244,12 @@ ACE_OS::rwlock_init (ACE_rwlock_t *rw,
if (result == -1)
{
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
ACE_OS::mutex_destroy (&rw->lock_);
ACE_OS::cond_destroy (&rw->waiting_readers_);
ACE_OS::cond_destroy (&rw->waiting_writers_);
ACE_OS::cond_destroy (&rw->waiting_important_writer_);
- errno = error;
}
return result;
# else
diff --git a/ace/OS.h b/ace/OS.h
index 5fd91d883fb..3273a761dcf 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -4685,6 +4685,52 @@ extern "C" {
typedef int (*ACE_COMPARE_FUNC)(const void *, const void *);
}
+class ACE_Errno_Guard
+{
+ // = TITLE
+ // Provides a wrapper to improve performance when thread-specific
+ // errno must be saved and restored in a block of code.
+ //
+ // = DESCRIPTION
+ // The typical use-case for this is the following:
+ //
+ // int error = errno;
+ // call_some_function_that_might_change_errno ();
+ // errno = error;
+ //
+ // This can be replaced with
+ //
+ // {
+ // ACE_Errno_Guard guard (errno);
+ // call_some_function_that_might_change_errno ();
+ // }
+ //
+ // This implementation is more elegant and more efficient since it
+ // avoids an unnecessary second access to thread-specific storage
+ // by caching a pointer to the value of errno in TSS.
+public:
+ ACE_Errno_Guard (int &e):
+#if defined (ACE_MT_SAFE)
+ ep_ (&e),
+#endif /* ACE_MT_SAFE */
+ error_ (e) { }
+
+ ~ACE_Errno_Guard (void)
+ {
+#if defined (ACE_MT_SAFE)
+ *ep_ = error_;
+#else
+ errno = error_;
+#endif /* ACE_MT_SAFE */
+ }
+
+private:
+#if defined (ACE_MT_SAFE)
+ int *ep_;
+#endif /* ACE_MT_SAFE */
+ int error_;
+};
+
class ACE_Export ACE_OS
{
// = TITLE
diff --git a/ace/OS.i b/ace/OS.i
index 5bd1756d4c3..e55819b5d9f 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -2588,9 +2588,11 @@ ACE_OS::recursive_mutex_lock (ACE_recursive_thread_mutex_t *m)
m->nesting_level_++;
}
- int error = errno;
- ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
- errno = error;
+ {
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+ ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
+ }
return result;
#endif /* ACE_HAS_RECURSIVE_MUTEXES */
#else
@@ -2631,9 +2633,11 @@ ACE_OS::recursive_mutex_trylock (ACE_recursive_thread_mutex_t *m)
}
}
- int error = errno;
- ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
- errno = error;
+ {
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+ ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
+ }
return result;
#endif /* ACE_HAS_RECURSIVE_MUTEXES */
#else
@@ -2682,9 +2686,12 @@ ACE_TRACE ("ACE_Recursive_Thread_Mutex::release");
}
}
}
- int error = errno;
- ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
- errno = error;
+
+ {
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+ ACE_OS::thread_mutex_unlock (&m->nesting_mutex_);
+ }
return result;
#endif /* ACE_HAS_RECURSIVE_MUTEXES */
#else
@@ -3624,7 +3631,7 @@ ACE_OS::rw_unlock (ACE_rwlock_t *rw)
int error = 0;
if (rw->important_writer_ && rw->ref_count_ == 1)
- // only the reader requesting to upgrade its lock is left over
+ // Only the reader requesting to upgrade its lock is left over.
{
result = ACE_OS::cond_signal (&rw->waiting_important_writer_);
error = errno;
diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp
index f3581390241..d1d3f0ada79 100644
--- a/ace/Process_Manager.cpp
+++ b/ace/Process_Manager.cpp
@@ -265,12 +265,9 @@ ACE_Process_Manager::terminate (pid_t pid)
if (result == -1)
{
- // We need to save this across calls to remove_thr() since that
- // call may reset errno.
- int error = errno;
-
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
this->remove (this->proc_table_[i].proc_id_);
- errno = error;
return -1;
}
else
diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp
index 928a9b98de3..72881602d7d 100644
--- a/ace/Remote_Tokens.cpp
+++ b/ace/Remote_Tokens.cpp
@@ -257,9 +257,10 @@ ACE_Remote_Token_Proxy::tryacquire (void (*sleep_hook)(void *))
{
if (debug_)
{
- int error = errno;
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("shadow try acquire failed\n")));
- errno = error;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("shadow try acquire failed\n")));
}
return -1;
@@ -307,11 +308,14 @@ ACE_Remote_Token_Proxy::renew (int requeue_position,
if (result == -1)
{
- int error = errno;
- ACE_Token_Proxy::release ();
- errno = error;
- ACE_ERROR_RETURN ((LM_ERROR, "%p error on remote renew, releasing shadow mutex.\n",
- "ACE_Remote_Token_Proxy"), -1);
+ {
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+ ACE_Token_Proxy::release ();
+ }
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p error on remote renew, releasing shadow mutex.\n",
+ "ACE_Remote_Token_Proxy"), -1);
}
else
{
diff --git a/ace/SOCK_Acceptor.cpp b/ace/SOCK_Acceptor.cpp
index f86f37c67b5..62f12886438 100644
--- a/ace/SOCK_Acceptor.cpp
+++ b/ace/SOCK_Acceptor.cpp
@@ -159,15 +159,12 @@ ACE_SOCK_Acceptor::shared_accept (ACE_Addr *remote_addr,
if (ACE_BIT_DISABLED (val, ACE_NONBLOCK))
{
- // We need to stash errno here because <ACE::clr_flags>
- // may reset it.
- int error = errno;
-
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// Only disable ACE_NONBLOCK if we weren't in
// non-blocking mode originally.
ACE::clr_flags (handle, ACE_NONBLOCK);
ACE::clr_flags (new_handle, ACE_NONBLOCK);
- errno = error;
}
}
}
diff --git a/ace/SOCK_Connector.cpp b/ace/SOCK_Connector.cpp
index 0d2c4ddabb5..6a1edc9028d 100644
--- a/ace/SOCK_Connector.cpp
+++ b/ace/SOCK_Connector.cpp
@@ -95,10 +95,9 @@ ACE_SOCK_Connector::connect (ACE_SOCK_Stream &new_stream,
new_stream.disable (ACE_NONBLOCK);
else if (!(errno == EWOULDBLOCK || errno == ETIMEDOUT))
{
- // If things have gone wrong, close down and return an error.
- int saved_errno = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
new_stream.close ();
- errno = saved_errno;
}
return result;
@@ -123,10 +122,9 @@ ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
if (h == ACE_INVALID_HANDLE)
{
- // Preserve the value of errno across the close() call.
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
new_stream.close ();
- errno = error;
return -1;
}
else // We've successfully connected!
@@ -140,10 +138,9 @@ ACE_SOCK_Connector::complete (ACE_SOCK_Stream &new_stream,
if (ACE_OS::getpeername (h, addr, &len) == -1)
{
- // Preserve the value of errno across the close() call.
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
new_stream.close ();
- errno = error;
return -1;
}
}
diff --git a/ace/Signal.cpp b/ace/Signal.cpp
index 859076fcde1..16fd4fef9f5 100644
--- a/ace/Signal.cpp
+++ b/ace/Signal.cpp
@@ -320,8 +320,8 @@ ACE_Sig_Handler::dispatch (int signum,
ACE_TSS_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
#endif /* 0 */
- // Preserve errno across callbacks!
- int old_errno = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// We can't use the <sig_pending> call here because that acquires
// the lock, which is non-portable...
@@ -351,9 +351,6 @@ ACE_Sig_Handler::dispatch (int signum,
eh->handle_close (ACE_INVALID_HANDLE,
ACE_Event_Handler::SIGNAL_MASK);
}
-
- // Restore error when callback completes.
- errno = old_errno;
}
ACE_Sig_Adapter::ACE_Sig_Adapter (ACE_Sig_Action &sa, int sigkey)
@@ -686,8 +683,8 @@ ACE_Sig_Handlers::dispatch (int signum,
ACE_TSS_Guard<ACE_Recursive_Thread_Mutex> m (*lock));
#endif /* 0 */
- // Preserve errno across callbacks!
- int old_errno = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
ACE_Sig_Handler::sig_pending_ = 1;
@@ -709,9 +706,6 @@ ACE_Sig_Handlers::dispatch (int signum,
delete *eh;
}
}
-
- // Restore error when callback completes.
- errno = old_errno;
}
// Return the first item in the list of handlers. Note that this will
diff --git a/ace/Synch_T.cpp b/ace/Synch_T.cpp
index 4984d772f13..5946d443182 100644
--- a/ace/Synch_T.cpp
+++ b/ace/Synch_T.cpp
@@ -410,16 +410,18 @@ ACE_TSS<TYPE>::ACE_TSS (TYPE *ts_obj)
{
if (this->ts_init () == -1)
{
- int errnum = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
// What should we do if this call fails?!
#if defined (ACE_HAS_WINCE)
- ::MessageBox (NULL, L"ACE_Thread::keycreate() failed!",
- L"ACE_TSS::ACE_TSS", MB_OK);
+ ::MessageBox (NULL,
+ L"ACE_Thread::keycreate() failed!",
+ L"ACE_TSS::ACE_TSS",
+ MB_OK);
#else
ACE_OS::fprintf (stderr,
"ACE_Thread::keycreate() failed!");
#endif /* ACE_HAS_WINCE */
- errno = errnum;
return;
}
diff --git a/ace/Thread_Manager.cpp b/ace/Thread_Manager.cpp
index 337a378dbd2..48b0c866644 100644
--- a/ace/Thread_Manager.cpp
+++ b/ace/Thread_Manager.cpp
@@ -1157,13 +1157,12 @@ ACE_Thread_Manager::kill_thr (ACE_Thread_Descriptor *td, int signum)
return -1; \
} \
int result = OP (ptr, ARG); \
- int error = errno; \
+ ACE_Errno_Guard 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, 1); \
} \
- errno = error; \
return result
// Suspend a single thread.
@@ -1349,12 +1348,13 @@ 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)
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+
+ for (ACE_Thread_Descriptor *td;
+ this->thr_to_be_removed_.dequeue_head (td) != -1;
+ )
this->remove_thr (td, 1);
- errno = error;
}
return result;
@@ -1419,12 +1419,13 @@ 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)
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+
+ for (ACE_Thread_Descriptor *td;
+ this->thr_to_be_removed_.dequeue_head (td) != -1;
+ )
this->remove_thr (td, 1);
- errno = error;
}
return result;
@@ -1864,12 +1865,13 @@ 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)
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
+
+ for (ACE_Thread_Descriptor *td;
+ this->thr_to_be_removed_.dequeue_head (td) != -1;
+ )
this->remove_thr (td, 1);
- errno = error;
}
return result;
diff --git a/ace/Token_Collection.cpp b/ace/Token_Collection.cpp
index c1d4ab17e15..e275942ea22 100644
--- a/ace/Token_Collection.cpp
+++ b/ace/Token_Collection.cpp
@@ -88,13 +88,16 @@ ACE_Token_Collection::acquire (int notify,
iterator.advance ())
{
if (debug_)
- ACE_DEBUG ((LM_DEBUG, ASYS_TEXT ("collection acquiring %s\n"),
+ ACE_DEBUG ((LM_DEBUG,
+ ASYS_TEXT ("collection acquiring %s\n"),
temp->int_id_->name ()));
- if (temp->int_id_->acquire (notify, sleep_hook, options) == -1)
+ if (temp->int_id_->acquire (notify,
+ sleep_hook,
+ options) == -1)
{
- int error = errno;
+ // Save/restore errno.
+ ACE_Errno_Guard error (errno);
this->release ();
- errno = error;
ACE_RETURN (-1);
}
}