Document return values
[ACE_TAO.git] / ACE / ace / Process_Mutex.inl
blob9a1b37a5f999433c1518c235eacaed21a6e3ac2e
1 // -*- C++ -*-
2 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
4 #if !defined (_ACE_USE_SV_SEM)
5 ACE_INLINE const ACE_mutex_t &
6 ACE_Process_Mutex::lock () const
8 // ACE_TRACE ("ACE_Process_Mutex::lock");
9   return this->lock_.lock ();
11 #endif /* !_ACE_USE_SV_SEM */
13 // Explicitly destroy the mutex.
14 ACE_INLINE int
15 ACE_Process_Mutex::remove ()
17   return this->lock_.remove ();
20 // Acquire lock ownership (wait on priority queue if necessary).
21 ACE_INLINE int
22 ACE_Process_Mutex::acquire ()
24 #if defined (_ACE_USE_SV_SEM)
25   return this->lock_.acquire (0, SEM_UNDO);
26 #else
27   return this->lock_.acquire ();
28 #endif // _ACE_USE_SV_SEM
31 // Acquire lock ownership (wait on priority queue if necessary).
32 ACE_INLINE int
33 ACE_Process_Mutex::acquire (ACE_Time_Value &tv)
35 #if !defined (_ACE_USE_SV_SEM)
36   return this->lock_.acquire (tv);
37 #else
38   ACE_UNUSED_ARG (tv);
39   ACE_NOTSUP_RETURN (-1);
40 #endif  /* !_ACE_USE_SV_SEM */
43 // Conditionally acquire lock (i.e., don't wait on queue).
44 ACE_INLINE int
45 ACE_Process_Mutex::tryacquire ()
47 #if defined (_ACE_USE_SV_SEM)
48   return this->lock_.tryacquire (0, SEM_UNDO);
49 #else
50   return this->lock_.tryacquire ();
51 #endif // _ACE_USE_SV_SEM
54 // Release lock and unblock a thread at head of priority queue.
55 ACE_INLINE int
56 ACE_Process_Mutex::release ()
58 #if defined (_ACE_USE_SV_SEM)
59   return this->lock_.release (0, SEM_UNDO);
60 #else
61   return this->lock_.release ();
62 #endif // _ACE_USE_SV_SEM
65 // Acquire lock ownership (wait on priority queue if necessary).
66 ACE_INLINE int
67 ACE_Process_Mutex::acquire_read ()
69 #if defined (_ACE_USE_SV_SEM)
70   return this->lock_.acquire_read (0, SEM_UNDO);
71 #else
72   return this->lock_.acquire_read ();
73 #endif // _ACE_USE_SV_SEM
76 // Acquire lock ownership (wait on priority queue if necessary).
77 ACE_INLINE int
78 ACE_Process_Mutex::acquire_write ()
80 #if defined (_ACE_USE_SV_SEM)
81   return this->lock_.acquire_write (0, SEM_UNDO);
82 #else
83   return this->lock_.acquire_write ();
84 #endif // _ACE_USE_SV_SEM
87 // Conditionally acquire a lock (i.e., won't block).
88 ACE_INLINE int
89 ACE_Process_Mutex::tryacquire_read ()
91 #if defined (_ACE_USE_SV_SEM)
92   return this->lock_.tryacquire_read (0, SEM_UNDO);
93 #else
94   return this->lock_.tryacquire_read ();
95 #endif // _ACE_USE_SV_SEM
98 // Conditionally acquire a lock (i.e., won't block).
99 ACE_INLINE int
100 ACE_Process_Mutex::tryacquire_write ()
102 #if defined (_ACE_USE_SV_SEM)
103   return this->lock_.tryacquire_write (0, SEM_UNDO);
104 #else
105   return this->lock_.tryacquire_write ();
106 #endif // _ACE_USE_SV_SEM
109 ACE_INLINE int
110 ACE_Process_Mutex::tryacquire_write_upgrade ()
112   return 0;
115 ACE_INLINE const ACE_TCHAR *
116 ACE_Process_Mutex::name () const
118 #if defined _ACE_USE_SV_SEM || !defined ACE_MUTEX_USE_PROCESS_LOCK
119   return 0;
120 #else
121   return this->lock_.lockname_;
122 #endif
125 ACE_END_VERSIONED_NAMESPACE_DECL