#include <Mutex.h>

Public Types | |
| typedef Poco::ScopedLock < FastMutex > | ScopedLock |
Public Member Functions | |
| FastMutex () | |
| void | lock () |
| destroys the Mutex. | |
| void | lock (long milliseconds) |
| bool | tryLock () |
| bool | tryLock (long milliseconds) |
| void | unlock () |
| ~FastMutex () | |
| creates the Mutex. | |
Private Member Functions | |
| FastMutex (const FastMutex &) | |
| FastMutex & | operator= (const FastMutex &) |
A FastMutex (mutual exclusion) is similar to a Mutex. Unlike a Mutex, however, a FastMutex is not recursive, which means that a deadlock will occur if the same thread tries to lock a mutex it has already locked again. Locking a FastMutex is faster than locking a recursive Mutex. Using the ScopedLock class is the preferred way to automatically lock and unlock a mutex.
| Poco::FastMutex::FastMutex | ( | const FastMutex & | ) | [private] |
Unlocks the mutex so that it can be acquired by other threads.
| void Poco::FastMutex::lock | ( | ) | [inline] |
| void Poco::FastMutex::lock | ( | long | milliseconds | ) | [inline] |
| bool Poco::FastMutex::tryLock | ( | ) | [inline] |
Locks the mutex. Blocks up to the given number of milliseconds if the mutex is held by another thread. Throws a TimeoutException if the mutex can not be locked within the given timeout.
Performance Note: On most platforms (including Windows), this member function is implemented using a loop calling (the equivalent of) tryLock() and Thread::sleep(). On POSIX platforms that support pthread_mutex_timedlock(), this is used.
| bool Poco::FastMutex::tryLock | ( | long | milliseconds | ) | [inline] |
| void Poco::FastMutex::unlock | ( | ) | [inline] |
Locks the mutex. Blocks up to the given number of milliseconds if the mutex is held by another thread. Returns true if the mutex was successfully locked.
Performance Note: On most platforms (including Windows), this member function is implemented using a loop calling (the equivalent of) tryLock() and Thread::sleep(). On POSIX platforms that support pthread_mutex_timedlock(), this is used.