first commit

This commit is contained in:
2019-08-19 19:19:58 +08:00
parent 7bb6b54204
commit 2b71bf8135
145 changed files with 23208 additions and 0 deletions

37
inc/hgl/proc/ProcMutex.h Normal file
View File

@@ -0,0 +1,37 @@
#ifndef HGL_PROCESS_MUTEX_INCLUDE
#define HGL_PROCESS_MUTEX_INCLUDE
#include<hgl/type/DataType.h>
#if HGL_OS!=HGL_OS_Windows
#include<semaphore.h>
#endif//HGL_OS!=HGL_OS_Windows
namespace hgl
{
/**
* 进程排斥
*/
class ProcMutex ///进程排斥
{
#if HGL_OS==HGL_OS_Windows
void *lock;
#else
sem_t *lock;
#endif//HGL_OS==HGL_OS_Windows
public:
ProcMutex();
~ProcMutex(){Clear();}
bool Create(const os_char *); ///<创建进程排斥
void Clear(); ///<清除进程排斥
bool Lock(); ///<锁定
bool TryLock(); ///<尝试锁定
bool Unlock(); ///<解锁
};//class ProcMutex
}//namespace hgl
#endif//HGL_PROCESS_MUTEX_INCLUDE