Panda3D
 All Classes Functions Variables Enumerations
conditionVarSpinlockImpl.I
1 // Filename: conditionVarSpinlockImpl.I
2 // Created by: drose (11Apr06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ConditionVarSpinlockImpl::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE ConditionVarSpinlockImpl::
22 ConditionVarSpinlockImpl(MutexSpinlockImpl &mutex) : _mutex(mutex) {
23  _event = 0;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: ConditionVarSpinlockImpl::Destructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE ConditionVarSpinlockImpl::
32 ~ConditionVarSpinlockImpl() {
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function: ConditionVarSpinlockImpl::notify
37 // Access: Public
38 // Description:
39 ////////////////////////////////////////////////////////////////////
40 INLINE void ConditionVarSpinlockImpl::
41 notify() {
42  // This will wake up all waiters on the lock. But that's allowed.
43  AtomicAdjust::inc(_event);
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: ConditionVarSpinlockImpl::notify_all
48 // Access: Public
49 // Description:
50 ////////////////////////////////////////////////////////////////////
51 INLINE void ConditionVarSpinlockImpl::
52 notify_all() {
53  AtomicAdjust::inc(_event);
54 }
static void inc(Integer &var)
Atomically increments the indicated variable.