aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
diff options
context:
space:
mode:
authorEric Lombrozo <elombrozo@gmail.com>2013-06-24 09:10:15 -0700
committerEric Lombrozo <elombrozo@gmail.com>2013-06-25 16:54:58 -0700
commit042da8bc0d913a84b62600399ffe93e1a88f50b3 (patch)
tree472818b9303b5125c079953a2a3d880104792248 /src/sync.h
parent79f6925facba6546987137f2c54948cad4dc69df (diff)
Added comments to sync.h to make it easier to understand the macros
Diffstat (limited to 'src/sync.h')
-rw-r--r--src/sync.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/sync.h b/src/sync.h
index 930c9b2b80..64de7cc57c 100644
--- a/src/sync.h
+++ b/src/sync.h
@@ -11,6 +11,48 @@
#include <boost/thread/condition_variable.hpp>
#include "threadsafety.h"
+
+////////////////////////////////////////////////
+// //
+// THE SIMPLE DEFINITON, EXCLUDING DEBUG CODE //
+// //
+////////////////////////////////////////////////
+
+/*
+
+
+
+CCriticalSection mutex;
+ boost::recursive_mutex mutex;
+
+LOCK(mutex);
+ boost::unique_lock<boost::recursive_mutex> criticalblock(mutex);
+
+LOCK2(mutex1, mutex2);
+ boost::unique_lock<boost::recursive_mutex> criticalblock1(mutex1);
+ boost::unique_lock<boost::recursive_mutex> criticalblock2(mutex2);
+
+TRY_LOCK(mutex, name);
+ boost::unique_lock<boost::recursive_mutex> name(mutex, boost::try_to_lock_t);
+
+ENTER_CRITICAL_SECTION(mutex); // no RAII
+ mutex.lock();
+
+LEAVE_CRITICAL_SECTION(mutex); // no RAII
+ mutex.unlock();
+
+
+
+ */
+
+
+
+///////////////////////////////
+// //
+// THE ACTUAL IMPLEMENTATION //
+// //
+///////////////////////////////
+
// Template mixin that adds -Wthread-safety locking annotations to a
// subset of the mutex API.
template <typename PARENT>