#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) | |
~ACE_Errno_Guard (void) | |
Reset the value of errno to . | |
int | operator= (int error) |
Assign to . | |
bool | operator== (int error) |
Compare with for equality. | |
bool | operator!= (int error) |
Compare with for inequality. | |
Private Member Functions | |
ACE_Errno_Guard (const ACE_Errno_Guard &) | |
ACE_Errno_Guard & | operator= (const ACE_Errno_Guard &) |
Private Attributes | |
int | error_ |
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.
Definition at line 46 of file OS_Errno.h.
|
Stash the value of into and initialize the to the address of . Definition at line 8 of file OS_Errno.inl.
00010 : 00011 #if defined (ACE_MT_SAFE) 00012 errno_ptr_ (&errno_ref), 00013 #endif /* ACE_MT_SAFE */ 00014 error_ (error) 00015 { 00016 #if !defined(ACE_MT_SAFE) 00017 ACE_UNUSED_ARG (errno_ref); 00018 #endif /* ACE_MT_SAFE */ 00019 } |
|
Stash the value of Definition at line 22 of file OS_Errno.inl.
00023 : 00024 #if defined (ACE_MT_SAFE) 00025 errno_ptr_ (&errno_ref), 00026 #endif /* ACE_MT_SAFE */ 00027 error_ (errno_ref) 00028 { 00029 } |
|
Reset the value of
Definition at line 32 of file OS_Errno.inl.
00033 { 00034 #if defined (ACE_MT_SAFE) 00035 *errno_ptr_ = this->error_; 00036 #else 00037 errno = this->error_; 00038 #endif /* ACE_MT_SAFE */ 00039 } |
|
|
|
Compare with for inequality.
Definition at line 62 of file OS_Errno.inl.
00063 { 00064 return this->error_ != error; 00065 } |
|
|
|
Assign to .
Definition at line 50 of file OS_Errno.inl.
00051 { 00052 return this->error_ = error; 00053 } |
|
Compare with for equality.
Definition at line 56 of file OS_Errno.inl.
00057 { 00058 return this->error_ == error; 00059 } |
|
Definition at line 83 of file OS_Errno.h. |