?? mysemaphore.h
字號:
#ifndef mySemaphore_H
#define mySemaphore_H
#define OPEN 0
#define CREATE 1
#define _WIN32_WINNT 0x0400
#include <windows.h>
#include <winuser.h>
#include <winbase.h>
#include <string>
using namespace std;
class mySemaphore
{
public:
mySemaphore(string& sName=string(""),
long initialCount=0,long maxCount=1,
int accessMode=CREATE,BOOL canInherit=TRUE);
virtual ~mySemaphore();
public:
void closeSemaphore();
BOOL lock(BOOL wait=TRUE);
void unlock();
public:
string& getSemaphoreName() { return semaphoreName; }
long getInitialCount() { return initCount; }
long getMaxCount() { return maxCount; }
BOOL getInerit() { return inherit; }
private:
void getErrorDetail(int&,string&);
private:
long initCount; // initialCount
long maxCount; // max count
BOOL inherit; // can be inherited by child
string semaphoreName;
HANDLE semaphore;
LPSECURITY_ATTRIBUTES sa;
};
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -