semaphore.cpp
来自「Jazmyn is a 32-bit, protected mode, mult」· C++ 代码 · 共 28 行
CPP
28 行
#include <sys\types.h>
#include <semaphore.h>
__semaphore::__semaphore(int cnt)
{
__max_cnt = cnt;
}
__semaphore::~__semaphore()
{
}
void __semaphore::down()
{
while(!__max_cnt);
__max_cnt--;
}
void __semaphore::up()
{
__max_cnt++;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?