Library: Foundation
Package: Threading
Header: Poco/ScopedLock.h
Description
A class that simplifies thread synchronization with a mutex. The constructor accepts a Mutex (and optionally a timeout value in milliseconds) and locks it. The destructor unlocks the mutex. The unlock() member function allows for manual unlocking of the mutex.
Member Summary
Member Functions: lock, operator =, ownsLock, tryLock, unlock
Constructors
ScopedLockWithUnlock
ScopedLockWithUnlock() = delete;
ScopedLockWithUnlock
explicit ScopedLockWithUnlock(
M & mutex
);
ScopedLockWithUnlock
ScopedLockWithUnlock(
const ScopedLockWithUnlock & param374
) = delete;
ScopedLockWithUnlock
ScopedLockWithUnlock(
M & mutex,
long milliseconds
);
ScopedLockWithUnlock
ScopedLockWithUnlock(
M & mutex,
std::adopt_lock_t
);
Construct and assume already locked
ScopedLockWithUnlock
ScopedLockWithUnlock(
M & mutex,
std::try_to_lock_t
);
Construct and try to lock
ScopedLockWithUnlock
ScopedLockWithUnlock(
M & mutex,
std::defer_lock_t
);
Construct but don't lock
Destructor
~ScopedLockWithUnlock
Member Functions
lock
void lock();
operator =
ScopedLockWithUnlock & operator = (
const ScopedLockWithUnlock & param375
) = delete;
ownsLock
bool ownsLock() const;
tryLock
bool tryLock();
unlock
void unlock();