ACE
6.3.3
|
Provides a wrapper to improve performance when thread-specific errno must be saved and restored in a block of code. More...
#include <OS_Errno.h>
Public Member Functions | |
ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref, int error) | |
ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref) | |
Initialize the errno_ptr_ to the address of errno_ref. More... | |
~ACE_Errno_Guard (void) | |
Reset the value of errno to <error>. More... | |
int | operator= (int error) |
Assign <error> to <error_>. More... | |
bool | operator== (int error) |
Compare <error> with <error_> for equality. More... | |
bool | operator!= (int error) |
Compare <error> with <error_> for inequality. More... | |
Private Member Functions | |
ACE_Errno_Guard (const ACE_Errno_Guard &) | |
ACE_Errno_Guard & | operator= (const ACE_Errno_Guard &) |
Private Attributes | |
int | error_ |
Provides a wrapper to improve performance when thread-specific errno must be saved and restored in a block of code.
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.
|
inline |
Stash the value of error into error_
and initialize the errno_ptr_
to the address of errno_ref.
|
inline |
Initialize the errno_ptr_
to the address of errno_ref.
|
inline |
Reset the value of errno
to <error>.
|
private |
|
inline |
Compare <error> with <error_> for inequality.
|
inline |
Assign <error> to <error_>.
|
private |
|
inline |
Compare <error> with <error_> for equality.
|
private |