UCommon
Namespaces | Macros | Typedefs | Functions | Variables
thread.h File Reference

Thread classes and sychronization objects. More...

#include <ucommon/cpr.h>
#include <ucommon/timers.h>
#include <ucommon/memory.h>
#include <ucommon/condition.h>
Include dependency graph for thread.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 ucommon
 Common namespace for all ucommon objects.
 

Macros

#define __AUTOLOCK(x)   autolock __autolock__(x)
 
#define __AUTOPROTECT(x)   AutoProtect __autolock__(x)
 
#define __SYNC(x)   for(bool _sync_flag_ = Mutex::protect(x); _sync_flag_; _sync_flag_ = !Mutex::release(x))
 

Typedefs

typedef Mutex ucommon::mutex_t
 Convenience type for using exclusive mutex locks.
 
typedef RecursiveMutex ucommon::rexlock_t
 Convenience type for using recursive exclusive locks.
 
typedef RWLock ucommon::rwlock_t
 Convenience type for using read/write locks.
 

Functions

class ucommon::__attribute__ ((visibility("default"))) ExclusiveProtocol
 An exclusive locking protocol interface base. More...
 

Variables

class __attribute__((visibility("default"))) JoinableThread class __attribute__((visibility("default"))) DetachedThread typedef TimedEvent ucommon::timedevent_t
 A child thread object that may be joined by parent. More...
 

Detailed Description

Thread classes and sychronization objects.

The theory behind ucommon thread classes is that they would be used to create derived classes where thread-specific data can be stored as member data of the derived class. The run method is called when the context is executed. Since we use a pthread foundation, we support both detached threads and joinable threads. Objects based on detached threads should be created with new, and will automatically delete when the thread context exits. Joinable threads will be joined with deleted.

Definition in file thread.h.