#include <OS_Errno.h>
Public Methods | |
| ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref, int error) | |
| Stash the value of <error> into <error_> and initialize the <errno_ptr_> to the address of <errno_ref>. More... | |
| ACE_Errno_Guard (ACE_ERRNO_TYPE &errno_ref) | |
| Stash the value of <errno> into <error_> and 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... | |
| int | operator== (int error) |
| Compare <error> with <error_> for equality. More... | |
| int | operator!= (int error) |
| Compare <error> with <error_> for inequality. More... | |
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 97 of file OS_Errno.h.
|
||||||||||||
|
Stash the value of <error> into <error_> and initialize the <errno_ptr_> to the address of <errno_ref>.
Definition at line 30 of file OS_Errno.inl. References ACE_ERRNO_TYPE.
00032 : 00033 #if defined (ACE_MT_SAFE) 00034 errno_ptr_ (&errno_ref), 00035 #endif /* ACE_MT_SAFE */ 00036 error_ (error) 00037 { 00038 #if !defined(ACE_MT_SAFE) 00039 ACE_UNUSED_ARG (errno_ref); 00040 #endif /* ACE_MT_SAFE */ 00041 } |
|
|
Stash the value of <errno> into <error_> and initialize the <errno_ptr_> to the address of <errno_ref>.
Definition at line 44 of file OS_Errno.inl. References ACE_ERRNO_TYPE.
00045 : 00046 #if defined (ACE_MT_SAFE) 00047 errno_ptr_ (&errno_ref), 00048 #endif /* ACE_MT_SAFE */ 00049 error_ (errno_ref) 00050 { 00051 } |
|
|
Reset the value of <errno> to <error>.
Definition at line 54 of file OS_Errno.inl. References error_.
|
|
|
Compare <error> with <error_> for inequality.
Definition at line 84 of file OS_Errno.inl. References error_.
00085 {
00086 return this->error_ != error;
00087 }
|
|
|
Assign <error> to <error_>.
Definition at line 72 of file OS_Errno.inl. References error_.
00073 {
00074 return this->error_ = error;
00075 }
|
|
|
Compare <error> with <error_> for equality.
Definition at line 78 of file OS_Errno.inl. References error_.
00079 {
00080 return this->error_ == error;
00081 }
|
|
|
Definition at line 130 of file OS_Errno.h. Referenced by operator!=, operator=, operator==, and ~ACE_Errno_Guard. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002