ZFFramework
 
Loading...
Searching...
No Matches
ZFMutex.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFMutex_h_
7#define _ZFI_ZFMutex_h_
8
9#include "ZFObject.h"
11
15zfclass ZFLIB_ZFCore ZFMutex : zfextend ZFObject {
16 ZFOBJECT_DECLARE(ZFMutex, ZFObject)
17
18public:
27 virtual inline void mutexLock(void) {
28 this->_ZFP_ZFObjectLock();
29 }
30
36 virtual inline zfbool mutexTryLock(void) {
37 return this->_ZFP_ZFObjectTryLock();
38 }
39
43 virtual inline void mutexUnlock(void) {
44 this->_ZFP_ZFObjectUnlock();
45 }
46};
47
49#endif // #ifndef _ZFI_ZFMutex_h_
50
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
ZFObject related include.
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
virtual void mutexUnlock(void)
release the lock, must be paired with mutexLock or mutexTryLock, and must be called in the same threa...
Definition ZFMutex.h:43
virtual void mutexLock(void)
wait until successfully acquired the lock
Definition ZFMutex.h:27
virtual zfbool mutexTryLock(void)
try to lock, or return false immediately if failed
Definition ZFMutex.h:36