25 #ifndef LOG4CPLUS_THREAD_SYNCPRIMS_H 26 #define LOG4CPLUS_THREAD_SYNCPRIMS_H 30 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE) 35 #include <condition_variable> 41 template <
typename SyncPrim>
54 void attach (SyncPrim
const &);
85 Semaphore (
unsigned max,
unsigned initial);
94 #if ! defined (LOG4CPLUS_SINGLE_THREADED) 95 mutable std::mutex mtx;
96 mutable std::condition_variable cv;
114 void signal ()
const;
116 bool timed_wait (
unsigned long msec)
const;
120 #if ! defined (LOG4CPLUS_SINGLE_THREADED) 121 mutable std::mutex mtx;
122 mutable std::condition_variable cv;
123 mutable bool signaled;
124 mutable unsigned sigcount;
136 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
137 void (SyncPrim:: * unlock_func) ()
const>
146 void attach (SyncPrim
const &);
163 void rdlock ()
const;
164 void rdunlock ()
const;
166 void wrlock ()
const;
167 void wrunlock ()
const;
189 template <
typename SyncPrim>
196 template <
typename SyncPrim>
205 template <
typename SyncPrim>
214 template <
typename SyncPrim>
223 template <
typename SyncPrim>
232 template <
typename SyncPrim>
241 template <
typename SyncPrim>
259 template <
typename SyncPrim>
272 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
273 void (SyncPrim:: * unlock_func) ()
const>
282 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
283 void (SyncPrim:: * unlock_func) ()
const>
288 (sp->*unlock_func) ();
292 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
293 void (SyncPrim:: * unlock_func) ()
const>
302 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
303 void (SyncPrim:: * unlock_func) ()
const>
308 (sp->*unlock_func) ();
312 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
313 void (SyncPrim:: * unlock_func) ()
const>
322 template <
typename SyncPrim, void (SyncPrim:: * lock_func) ()
const,
323 void (SyncPrim:: * unlock_func) ()
const>
335 #endif // LOG4CPLUS_THREAD_SYNCPRIMS_H
#define LOG4CPLUS_THREADED(x)
void attach(SyncPrim const &)
SyncGuard< Semaphore > SemaphoreGuard
void attach_and_lock(SyncPrim const &)
SyncGuard & operator=(SyncGuard const &)=delete
SyncGuard< Mutex > MutexGuard
SyncGuardFunc< SharedMutex, &SharedMutex::wrlock, &SharedMutex::wrunlock > SharedMutexWriterGuard
SyncGuardFunc< SharedMutex, &SharedMutex::rdlock, &SharedMutex::rdunlock > SharedMutexReaderGuard