3 //=============================================================================
5 * @file TSS_Test_Errno.h
7 * This file contains the definition of Errno. Some compilers need
8 * it in a .h file for template instantiation (such as AIX C Set
11 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
13 //=============================================================================
16 #include "ace/Guard_T.h"
17 #include "ace/Thread_Mutex.h"
22 * @brief Define a simple Errno abstraction
24 * This class gets its own header file to work around AIX C++
25 * compiler "features" related to template instantiation... It is
26 * only used by TSS_Test.cpp.
33 ACE_MT (ACE_GUARD (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
));
38 ACE_MT (ACE_GUARD (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
));
42 int error (void) { return this->errno_
; }
43 void error (int i
) { this->errno_
= i
; }
45 int line (void) { return this->lineno_
; }
46 void line (int l
) { this->lineno_
= l
; }
48 // Errno::flags_ is a static variable, so we've got to protect it
49 // with a mutex since it isn't kept in thread-specific storage.
52 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
, -1));
58 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex
, ace_mon
, *Errno::lock_
, -1));
64 static int created (void)
69 static int deleted (void)
74 #if defined (ACE_HAS_THREADS)
79 ACE_NEW_RETURN (Errno::lock_
, ACE_Thread_Mutex
, 0);
85 deallocate_lock () { delete lock_
; lock_
= 0; }
86 #endif /* ACE_HAS_THREADS */
89 // = errno_ and lineno_ will be thread-specific data so they don't
97 #if defined (ACE_HAS_THREADS)
98 // flags_ needs a lock.
99 static ACE_Thread_Mutex
*lock_
;
100 #endif /* ACE_HAS_THREADS */