Public Types | Public Member Functions | Private Member Functions
Poco::FastMutex Class Reference

#include <Mutex.h>

Inheritance diagram for Poco::FastMutex:
Inheritance graph
[legend]

List of all members.

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 &)
FastMutexoperator= (const FastMutex &)

Detailed Description

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.

Definition at line 114 of file Mutex.h.


Member Typedef Documentation

Definition at line 124 of file Mutex.h.


Constructor & Destructor Documentation

Definition at line 60 of file Mutex.cpp.

creates the Mutex.

Definition at line 65 of file Mutex.cpp.

Poco::FastMutex::FastMutex ( const FastMutex ) [private]

Unlocks the mutex so that it can be acquired by other threads.


Member Function Documentation

void Poco::FastMutex::lock ( ) [inline]

destroys the Mutex.

Definition at line 203 of file Mutex.h.

void Poco::FastMutex::lock ( long  milliseconds) [inline]

Locks the mutex. Blocks if the mutex is held by another thread.

Definition at line 209 of file Mutex.h.

FastMutex& Poco::FastMutex::operator= ( const FastMutex ) [private]
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.

Definition at line 216 of file Mutex.h.

bool Poco::FastMutex::tryLock ( long  milliseconds) [inline]

Tries to lock the mutex. Returns false immediately if the mutex is already held by another thread. Returns true if the mutex was successfully locked.

Definition at line 222 of file Mutex.h.

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.

Definition at line 228 of file Mutex.h.


The documentation for this class was generated from the following files:


pluginlib
Author(s): Tully Foote and Eitan Marder-Eppstein
autogenerated on Sat Dec 28 2013 17:20:20