aboutsummaryrefslogtreecommitdiff
path: root/src/stable/synchroatom.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/stable/synchroatom.h')
-rw-r--r--src/stable/synchroatom.h88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/stable/synchroatom.h b/src/stable/synchroatom.h
index 2822b20..1d996b6 100644
--- a/src/stable/synchroatom.h
+++ b/src/stable/synchroatom.h
@@ -14,50 +14,50 @@
14 14
15namespace Bu 15namespace Bu
16{ 16{
17 /** 17 /**
18 * A thread-safe wrapper class. 18 * A thread-safe wrapper class.
19 *@ingroup Threading 19 *@ingroup Threading
20 */ 20 */
21 template <class T> 21 template <class T>
22 class SynchroAtom 22 class SynchroAtom
23 { 23 {
24 public: 24 public:
25 /** 25 /**
26 * Construct an empty queue. 26 * Construct an empty queue.
27 */ 27 */
28 SynchroAtom() 28 SynchroAtom()
29 { 29 {
30 } 30 }
31 31
32 SynchroAtom( const T &src ) : 32 SynchroAtom( const T &src ) :
33 data( src ) 33 data( src )
34 { 34 {
35 } 35 }
36 36
37 ~SynchroAtom() 37 ~SynchroAtom()
38 { 38 {
39 } 39 }
40 40
41 T get() 41 T get()
42 { 42 {
43 mOperate.lock(); 43 mOperate.lock();
44 T ret = data; 44 T ret = data;
45 mOperate.unlock(); 45 mOperate.unlock();
46 return ret; 46 return ret;
47 } 47 }
48 48
49 void set( const T &val ) 49 void set( const T &val )
50 { 50 {
51 mOperate.lock(); 51 mOperate.lock();
52 data = val; 52 data = val;
53 mOperate.unlock(); 53 mOperate.unlock();
54 } 54 }
55 55
56 private: 56 private:
57 T data; 57 T data;
58 58
59 Mutex mOperate; /**< The master mutex, used on all operations. */ 59 Mutex mOperate; /**< The master mutex, used on all operations. */
60 }; 60 };
61}; 61};
62 62
63#endif 63#endif