diff --git a/Borland/Threads.h b/Borland/Threads.h index 337f4e2..2b95a75 100644 --- a/Borland/Threads.h +++ b/Borland/Threads.h @@ -97,7 +97,7 @@ namespace Loki template class ObjectLevelLockable { - CRITICAL_SECTION mtx_; + mutable CRITICAL_SECTION mtx_; public: ObjectLevelLockable() @@ -115,12 +115,12 @@ namespace Loki class Lock { - ObjectLevelLockable& host_; + ObjectLevelLockable const& host_; Lock(const Lock&); Lock& operator=(const Lock&); public: - Lock(Host& host) : host_(host) + Lock(const Host& host) : host_(host) { ::EnterCriticalSection(&host_.mtx_); } @@ -230,7 +230,7 @@ public: } ::EnterCriticalSection(&mtx_); } - Lock(Host&) + Lock(const Host&) { if (!mtx_initialisation_done) { initialize_impl(); diff --git a/MSVC/1300/Threads.h b/MSVC/1300/Threads.h index 21508e9..ab6cd79 100644 --- a/MSVC/1300/Threads.h +++ b/MSVC/1300/Threads.h @@ -73,7 +73,7 @@ namespace Loki template class ObjectLevelLockable { - CRITICAL_SECTION mtx_; + mutable CRITICAL_SECTION mtx_; public: ObjectLevelLockable() @@ -91,13 +91,13 @@ namespace Loki class Lock { - ObjectLevelLockable& host_; + ObjectLevelLockable const& host_; Lock(const Lock&); Lock& operator=(const Lock&); public: - explicit Lock(ObjectLevelLockable& host) : host_(host) + explicit Lock(const ObjectLevelLockable& host) : host_(host) { ::EnterCriticalSection(&host_.mtx_); } @@ -157,7 +157,7 @@ namespace Loki { ::EnterCriticalSection(&initializer_.mtx_); } - explicit Lock(ClassLevelLockable&) + explicit Lock(const ClassLevelLockable&) { ::EnterCriticalSection(&initializer_.mtx_); } diff --git a/Reference/Threads.h b/Reference/Threads.h index 21508e9..ab6cd79 100644 --- a/Reference/Threads.h +++ b/Reference/Threads.h @@ -73,7 +73,7 @@ namespace Loki template class ObjectLevelLockable { - CRITICAL_SECTION mtx_; + mutable CRITICAL_SECTION mtx_; public: ObjectLevelLockable() @@ -91,13 +91,13 @@ namespace Loki class Lock { - ObjectLevelLockable& host_; + ObjectLevelLockable const& host_; Lock(const Lock&); Lock& operator=(const Lock&); public: - explicit Lock(ObjectLevelLockable& host) : host_(host) + explicit Lock(const ObjectLevelLockable& host) : host_(host) { ::EnterCriticalSection(&host_.mtx_); } @@ -157,7 +157,7 @@ namespace Loki { ::EnterCriticalSection(&initializer_.mtx_); } - explicit Lock(ClassLevelLockable&) + explicit Lock(const ClassLevelLockable&) { ::EnterCriticalSection(&initializer_.mtx_); }