📄 mutexattr.h
字号:
////////////////////////////////////////////////////////////////////////// MutexAttr.h//// by Reiot//////////////////////////////////////////////////////////////////////////// Mutex-Attribute Class//// Mutex-Attribute 努贰胶绰 悼老茄 加己(attribute)狼 Mutex 努贰胶甫 // 咯矾 俺 积己且 鞘夸啊 乐阑 锭 pthread_mutex_init()狼 颇扼固磐肺 // 荤侩等促. 溜 窍唱狼 Mutex-Attribute 按眉父 积己秦初栏搁 等促绰 // 舵捞促.////////////////////////////////////////////////////////////////////////#ifndef __MUTEX_ATTR_H__#define __MUTEX_ATTR_H__//////////////////////////////////////////////////// include//////////////////////////////////////////////////#include <pthread.h>#include "Types.h"#include "pthreadAPI.h"#include "Exception.h"//////////////////////////////////////////////////// forward declaration//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// class MutexAttr;////////////////////////////////////////////////////////////////////////class MutexAttr {//////////////////////////////////////////////////// constructor / destructor//////////////////////////////////////////////////public : // constructor MutexAttr () throw ( Error ) { pthread_mutexattr_init( &m_Attr ); } // destructor ~MutexAttr () throw ( Error ) { pthread_mutexattr_destroy( &m_Attr ); } //////////////////////////////////////////////////// public methods//////////////////////////////////////////////////public : // // return mutex-attribute object // // *CAUTION* // // do not return pthread_mutexattr_t value !! // use pthread_mutexattr_t pointer instead. // (pthread_mutexattr_t 俊 措秦 assignment 啊 瘤盔登瘤 臼阑 // 啊瓷己 乐澜) // pthread_mutexattr_t * getAttr () throw () { return &m_Attr; } /* bool isFastMutex () const throw ( MutexAttrException ) { return getMutexKind() == PTHREAD_MUTEX_FAST_NP; } bool isRecursiveMutex () const throw ( MutexAttrException ) { return getMutexKind() == PTHREAD_MUTEX_RECURSIVE_NP; } bool isErrorCheckMutex () const throw ( MutexAttrException ) { return getMutexKind() == PTHREAD_MUTEX_ERRORCHECK_NP; } void setFastMutex () throw ( MutexAttrException ) { setMutexKind( PTHREAD_MUTEX_FAST_NP ); } void setRecursiveMutex () throw ( MutexAttrException ) { setMutexKind( PTHREAD_MUTEX_RECURSIVE_NP ); } void setErrorCheckMutex () throw ( MutexAttrException ) { setMutexKind( PTHREAD_MUTEX_ERRORCHECK_NP ); } // get mutex kind int getMutexKind () const throw ( MutexAttrException ); // set mutex kind void setMutexKind ( int Kind ) throw ( MutexAttrException ); *///////////////////////////////////////////////////// attributes//////////////////////////////////////////////////private : // mutex attribute pthread_mutexattr_t m_Attr;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -