summaryrefslogtreecommitdiff
path: root/ACE/ace/Process_Mutex.inl
blob: 6c19e8d6757ff48f4d1a45b72463b44cf3e30def (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// -*- C++ -*-
//
// $Id$

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

#if !defined (_ACE_USE_SV_SEM)
ACE_INLINE const ACE_mutex_t &
ACE_Process_Mutex::lock (void) const
{
// ACE_TRACE ("ACE_Process_Mutex::lock");
  return this->lock_.lock ();
}
#endif /* !_ACE_USE_SV_SEM */

// Explicitly destroy the mutex.
ACE_INLINE int
ACE_Process_Mutex::remove (void)
{
  return this->lock_.remove ();
}

// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.acquire (0, SEM_UNDO);
#else
  return this->lock_.acquire ();
#endif // _ACE_USE_SV_SEM
}

// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire (ACE_Time_Value &tv)
{
#if !defined (_ACE_USE_SV_SEM)
  return this->lock_.acquire (tv);
#else
  ACE_UNUSED_ARG (tv);
  ACE_NOTSUP_RETURN (-1);
#endif  /* !_ACE_USE_SV_SEM */
}

// Conditionally acquire lock (i.e., don't wait on queue).
ACE_INLINE int
ACE_Process_Mutex::tryacquire (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.tryacquire (0, SEM_UNDO);
#else
  return this->lock_.tryacquire ();
#endif // _ACE_USE_SV_SEM
}

// Release lock and unblock a thread at head of priority queue.
ACE_INLINE int
ACE_Process_Mutex::release (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.release (0, SEM_UNDO);
#else
  return this->lock_.release ();
#endif // _ACE_USE_SV_SEM
}

// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire_read (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.acquire_read (0, SEM_UNDO);
#else
  return this->lock_.acquire_read ();
#endif // _ACE_USE_SV_SEM
}

// Acquire lock ownership (wait on priority queue if necessary).
ACE_INLINE int
ACE_Process_Mutex::acquire_write (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.acquire_write (0, SEM_UNDO);
#else
  return this->lock_.acquire_write ();
#endif // _ACE_USE_SV_SEM
}

// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_Process_Mutex::tryacquire_read (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.tryacquire_read (0, SEM_UNDO);
#else
  return this->lock_.tryacquire_read ();
#endif // _ACE_USE_SV_SEM
}

// Conditionally acquire a lock (i.e., won't block).
ACE_INLINE int
ACE_Process_Mutex::tryacquire_write (void)
{
#if defined (_ACE_USE_SV_SEM)
  return this->lock_.tryacquire_write (0, SEM_UNDO);
#else
  return this->lock_.tryacquire_write ();
#endif // _ACE_USE_SV_SEM
}

ACE_INLINE int
ACE_Process_Mutex::tryacquire_write_upgrade (void)
{
  return 0;
}

ACE_END_VERSIONED_NAMESPACE_DECL