From 042da8bc0d913a84b62600399ffe93e1a88f50b3 Mon Sep 17 00:00:00 2001 From: Eric Lombrozo Date: Mon, 24 Jun 2013 09:10:15 -0700 Subject: [PATCH] Added comments to sync.h to make it easier to understand the macros --- src/sync.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/src/sync.h b/src/sync.h index 930c9b2b..64de7cc5 100644 --- a/src/sync.h +++ b/src/sync.h @@ -11,6 +11,48 @@ #include #include "threadsafety.h" + +//////////////////////////////////////////////// +// // +// THE SIMPLE DEFINITON, EXCLUDING DEBUG CODE // +// // +//////////////////////////////////////////////// + +/* + + + +CCriticalSection mutex; + boost::recursive_mutex mutex; + +LOCK(mutex); + boost::unique_lock criticalblock(mutex); + +LOCK2(mutex1, mutex2); + boost::unique_lock criticalblock1(mutex1); + boost::unique_lock criticalblock2(mutex2); + +TRY_LOCK(mutex, name); + boost::unique_lock 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