00001 #ifndef toast_log_thread_policies_hpp_INCLUDED
00002 #define toast_log_thread_policies_hpp_INCLUDED
00003
00013 namespace toast {
00014 namespace log {
00015
00034 template <typename Policy>
00035 struct ThreadPolicyConcept
00036 {
00041 void constraints() {
00042 typename Policy::scoped_lock guard(p);
00043 guard.unlock();
00044 guard.lock();
00045 b = guard.locked();
00046 }
00047 private:
00048 bool b;
00049 Policy p;
00050 };
00051
00056 struct neutral
00057 {
00058 struct scoped_lock {
00059 scoped_lock(neutral const &) {}
00060 void lock() {}
00061 void unlock() {}
00062 bool locked() { return false; }
00063 };
00064 protected:
00065 ~neutral() {}
00066 };
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00094 }
00095 }
00096
00097 #endif // toast_log_thread_policies_hpp_INCLUDED