3 //=============================================================================
5 * @file TSS_Test_Errno.h
7 * This file contains the definition of Errno.
9 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
11 //=============================================================================
14 #include "ace/Guard_T.h"
15 #include "ace/Thread_Mutex.h"
20 * @brief Define a simple Errno abstraction
22 * It is only used by TSS_Test.cpp.
29 ACE_MT (ACE_GUARD (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
));
34 ACE_MT (ACE_GUARD (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
));
38 int error () { return this->errno_
; }
39 void error (int i
) { this->errno_
= i
; }
41 int line () { return this->lineno_
; }
42 void line (int l
) { this->lineno_
= l
; }
44 // Errno::flags_ is a static variable, so we've got to protect it
45 // with a mutex since it isn't kept in thread-specific storage.
48 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex
, ace_Mon
, *Errno::lock_
, -1));
54 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex
, ace_mon
, *Errno::lock_
, -1));
70 #if defined (ACE_HAS_THREADS)
75 ACE_NEW_RETURN (Errno::lock_
, ACE_Thread_Mutex
, 0);
81 deallocate_lock () { delete lock_
; lock_
= 0; }
82 #endif /* ACE_HAS_THREADS */
85 // = errno_ and lineno_ will be thread-specific data so they don't
93 #if defined (ACE_HAS_THREADS)
94 // flags_ needs a lock.
95 static ACE_Thread_Mutex
*lock_
;
96 #endif /* ACE_HAS_THREADS */