?? group.h
字號:
//// spectral toolkit // copyright (c) 2005 university corporation for atmospheric research// licensed under the gnu general public license//#ifndef __group__#define __group__#include <pthread.h>namespace spectral{ class group; int sync(group*); int lock(group*); int unlock(group*); int size(group*); int sync(group&); int lock(group&); int unlock(group&); int size(group&); /// Thread syncronization object. Represents a mutex lock and /// condition variable object that can be shared among a collection /// or group of threads in order to provide syncronization and locking. /// Typically, a reference or pointer to a group object is passed to each /// thread in the group upon instantiation of the thread. The group size /// is an internal counter to keep track of the number of members of the group /// which can be dynamically increased or decreased with the ++ and -- operators. /// \sa sync lock unlock size fiber class group { public: group(); group(int); ~group(); void operator++(int); void operator--(int); private: /// Internal mutex lock used for sync function. pthread_mutex_t mutex; /// Internal mutex lock used for lock/unlock functions. pthread_mutex_t mutex_lock; /// Internal condition variable used for sync function. pthread_cond_t cond; /// Internal counter used for sync. int block; /// Internal counter used for sync. int count; /// Internal counter that keeps track of the group size. int threads; friend int sync(group*); friend int lock(group*); friend int unlock(group*); friend int size(group*); };}#endif// Local Variables:// mode:C++// End:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -