Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Null_Semaphore.h
blob1e3e4dac0bb7e4b9f1f9b64091a1b6cbea5f3d7d
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file Null_Semaphore.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //==========================================================================
11 #ifndef ACE_NULL_SEMAPHORE_H
12 #define ACE_NULL_SEMAPHORE_H
13 #include /**/ "ace/pre.h"
15 #include "ace/os_include/os_errno.h"
16 #include "ace/os_include/sys/os_types.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 class ACE_Time_Value;
26 /**
27 * @class ACE_Null_Semaphore
29 * @brief Implement a do nothing ACE_Semaphore, i.e., all the methods are
30 * no ops.
32 * Although the methods are no-ops, the return values are different for
33 * the blocking as opposed to timed acquires. The blocking version of
34 * acquire() is often used to serialize access to a critical section,
35 * whereas the timed version is often used to wait for another thread
36 * to update some condition or change some shared state. When using an
37 * ACE_Null_Semaphore, however, there's no other thread involved to
38 * change a state or condition (otherwise, a null semaphore would be
39 * inappropriate). Returning an error value signifies that the
40 * state or condition has not been (and can't be) changed, which is
41 * consistent with the behavior of the threaded case where a timeout
42 * occurs before the state or condition is changed.
44 class ACE_Null_Semaphore
46 public:
47 ACE_Null_Semaphore (unsigned int = 1,
48 int = 0,
49 const ACE_TCHAR * = 0,
50 void * = 0,
51 int = 0x7fffffff) {}
52 ~ACE_Null_Semaphore () = default;
53 /// Return 0.
54 int remove () {return 0;}
56 /// Return 0.
57 int acquire () {return 0;}
59 /// Return -1 with @c errno == @c ETIME.
60 int acquire (ACE_Time_Value &) {errno = ETIME; return -1;}
62 /// Return -1 with @c errno == @c ETIME.
63 int acquire (ACE_Time_Value *) {errno = ETIME; return -1;}
65 /// Return 0.
66 int tryacquire () {return 0;}
68 /// Return 0.
69 int release () {return 0;}
71 /// Return 0.
72 int release (size_t) {return 0;}
74 /// Return 0.
75 int acquire_write () {return 0;}
77 /// Return 0.
78 int tryacquire_write () {return 0;}
80 /// Return 0.
81 int tryacquire_write_upgrade () {return 0;}
83 /// Return 0.
84 int acquire_read () {return 0;}
86 /// Return 0.
87 int tryacquire_read () {return 0;}
89 /// Dump the state of an object.
90 void dump () const {}
92 /// Declare the dynamic allocation hooks.
93 //ACE_ALLOC_HOOK_DECLARE;
96 ACE_END_VERSIONED_NAMESPACE_DECL
98 #include /**/ "ace/post.h"
99 #endif /* ACE_NULL_SEMAPHORE_H */