Lock.h File Reference


Detailed Description

Contains the definitions for the different locking structures for multi-threading.

Id
Lock.h,v 1.11 2008/03/31 19:13:28 iamcamiel Exp

X-1.11 Camiel Vanderhoeven 31-MAR-2008 Moved Poco-includes to StdAfx.h

X-1.10 Camiel Vanderhoeven 26-MAR-2008 Fix compiler warnings.

X-1.9 Camiel Vanderhoeven 16-MAR-2008 Fixed threading problems with SDL (I hope). Standard locking timeout is now 5000 ms, but can be overridden by defining LOCK_TIMEOUT_MS or NO_LOCK_TIMEOUTS.

X-1.8 Camiel Vanderhoeven 14-MAR-2008 Fixed last patch to be platform-independent.

X-1.7 Camiel Vanderhoeven 14-MAR-2008 2-second timeouts on read/write mutexes.

X-1.6 Camiel Vanderhoeven 14-MAR-2008 2-second timeouts on simple mutexes.

X-1.5 Camiel Vanderhoeven 14-MAR-2008 Formatting.

X-1.4 Camiel Vanderhoeven 14-MAR-2008 1. More meaningful exceptions replace throwing (int) 1. 2. U64 macro replaces X64 macro.

X-1.3 Camiel Vanderhoeven 12-MAR-2007 Print an error message on locking failures.

X-1.2 Brian Wheeler 11-MAR-2007 Fixed macro concatenation syntax error.

X-1.1 Camiel Vanderhoeven 11-MAR-2007 File created to support named, debuggable mutexes.

Definition in file Lock.h.

Go to the source code of this file.

Data Structures

class  CScopedLock< M >
 A class that simplifies thread synchronization with a mutex or fastmutex. More...
class  CMutex
class  CFastMutex
class  CRWMutex
class  CScopedRWLock

Defines

#define LOCK_TIMEOUT_MS   5000
#define CURRENT_THREAD_NAME
 This Macro finds out what the current Poco::Thread object is, and returns it's name.
#define MUTEX_LOCK(mutex)   mutex->lock(LOCK_TIMEOUT_MS)
#define MUTEX_READ_LOCK(mutex)   mutex->readLock(LOCK_TIMEOUT_MS)
#define MUTEX_WRITE_LOCK(mutex)   mutex->writeLock(LOCK_TIMEOUT_MS)
#define MUTEX_UNLOCK(mutex)   mutex->unlock()
#define SCOPED_M_LOCK(mutex)   CMutex::ScopedLock L_##__LINE__(mutex)
#define SCOPED_FM_LOCK(mutex)   CFastMutex::ScopedLock L_##__LINE__(mutex)
#define SCOPED_READ_LOCK(mutex)   CRWMutex::ScopedLock L_##__LINE__(mutex, false)
#define SCOPED_WRITE_LOCK(mutex)   CRWMutex::ScopedLock L_##__LINE__(mutex, true)


Define Documentation

#define CURRENT_THREAD_NAME

Value:

Poco::Thread::current() ? Poco::Thread::current() \
    ->getName().c_str() : "main"
This Macro finds out what the current Poco::Thread object is, and returns it's name.

If there's no Poco::Thread object associated with this thread, it's assumed to be the main thread, and "main" is returned.

Definition at line 82 of file Lock.h.

Referenced by CFastMutex::lock(), CMutex::lock(), CRWMutex::readLock(), CFastMutex::tryLock(), CMutex::tryLock(), CRWMutex::tryReadLock(), CRWMutex::tryWriteLock(), CRWMutex::unlock(), CFastMutex::unlock(), CMutex::unlock(), and CRWMutex::writeLock().

#define LOCK_TIMEOUT_MS   5000

Definition at line 73 of file Lock.h.

Referenced by CScopedLock< M >::CScopedLock(), and CScopedRWLock::CScopedRWLock().

#define MUTEX_LOCK ( mutex   )     mutex->lock(LOCK_TIMEOUT_MS)

#define MUTEX_READ_LOCK ( mutex   )     mutex->readLock(LOCK_TIMEOUT_MS)

Definition at line 683 of file Lock.h.

#define MUTEX_UNLOCK ( mutex   )     mutex->unlock()

#define MUTEX_WRITE_LOCK ( mutex   )     mutex->writeLock(LOCK_TIMEOUT_MS)

Definition at line 684 of file Lock.h.

#define SCOPED_FM_LOCK ( mutex   )     CFastMutex::ScopedLock L_##__LINE__(mutex)

Definition at line 687 of file Lock.h.

Referenced by CSystem::cpu_break_lock(), CSystem::cpu_lock(), and CSystem::cpu_unlock().

#define SCOPED_M_LOCK ( mutex   )     CMutex::ScopedLock L_##__LINE__(mutex)

Definition at line 686 of file Lock.h.

#define SCOPED_READ_LOCK ( mutex   )     CRWMutex::ScopedLock L_##__LINE__(mutex, false)

Definition at line 688 of file Lock.h.

Referenced by CAliM1543C_ide::do_dma_transfer(), and CAliM1543C_ide::ide_control_read().

#define SCOPED_WRITE_LOCK ( mutex   )     CRWMutex::ScopedLock L_##__LINE__(mutex, true)


SourceForge.net Logo
Project space on SourceForge.net