25#ifndef LOG4CPLUS_THREAD_SYNCPRIMS_PUB_IMPL_H
26#define LOG4CPLUS_THREAD_SYNCPRIMS_PUB_IMPL_H
30#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
36#if (defined (LOG4CPLUS_INLINES_ARE_EXPORTED) \
37 && defined (LOG4CPLUS_BUILD_DLL)) \
38 || defined (LOG4CPLUS_ENABLE_SYNCPRIMS_PUB_IMPL)
41#if ! defined (LOG4CPLUS_SINGLE_THREADED)
45#define LOG4CPLUS_THROW_RTE(msg) \
46 do { log4cplus::thread::impl::syncprims_throw_exception (msg, __FILE__, \
47 __LINE__); } while (0)
56 char const *
const file,
int line);
86#if defined (LOG4CPLUS_SINGLE_THREADED)
89 return mtx.try_lock ();
140#if ! defined (LOG4CPLUS_SINGLE_THREADED)
142 , val ((std::min) (maximum, initial))
156#if ! defined (LOG4CPLUS_SINGLE_THREADED)
157 std::lock_guard<std::mutex> guard (mtx);
160 LOG4CPLUS_THROW_RTE (
"Semaphore::unlock(): val >= max");
172#if ! defined (LOG4CPLUS_SINGLE_THREADED)
173 std::unique_lock<std::mutex> guard (mtx);
176 LOG4CPLUS_THROW_RTE (
"Semaphore::unlock(): val > max");
184 LOG4CPLUS_THROW_RTE (
"Semaphore::unlock(): val >= max");
195#if ! defined (LOG4CPLUS_SINGLE_THREADED)
211#if ! defined (LOG4CPLUS_SINGLE_THREADED)
212 std::unique_lock<std::mutex> guard (mtx);
225#if ! defined (LOG4CPLUS_SINGLE_THREADED)
226 std::unique_lock<std::mutex> guard (mtx);
230 unsigned prev_count = sigcount;
235 while (prev_count == sigcount);
245#if defined (LOG4CPLUS_SINGLE_THREADED)
249 std::unique_lock<std::mutex> guard (mtx);
253 unsigned prev_count = sigcount;
255 std::chrono::steady_clock::time_point
const wait_until_time
256 = std::chrono::steady_clock::now ()
257 + std::chrono::milliseconds (msec);
261 int ret =
static_cast<int>(
262 cv.wait_until (guard, wait_until_time));
265 case static_cast<int>(std::cv_status::no_timeout):
268 case static_cast<int>(std::cv_status::timeout):
274 LOG4CPLUS_THROW_RTE (
"ManualResetEvent::timed_wait");
277 while (prev_count == sigcount);
289#if ! defined (LOG4CPLUS_SINGLE_THREADED)
290 std::lock_guard<std::mutex> guard (mtx);
317SharedMutex::~SharedMutex ()
325SharedMutex::rdlock ()
const
333SharedMutex::wrlock ()
const
341SharedMutex::rdunlock ()
const
349SharedMutex::wrunlock ()
const
ManualResetEvent(bool=false)
bool timed_wait(unsigned long msec) const
Semaphore(unsigned max, unsigned initial)
#define LOG4CPLUS_ATTRIBUTE_NORETURN
#define LOG4CPLUS_INLINE_EXPORT
#define LOG4CPLUS_THREADED(x)
#define LOG4CPLUS_UNLIKELY(cond)
LOG4CPLUS_EXPORT void LOG4CPLUS_ATTRIBUTE_NORETURN syncprims_throw_exception(char const *const msg, char const *const file, int line)