#include <iostream>
#include <windows.h>
using namespace std;
void main()
{
    cout<<"OK"<<endl;
    while(TRUE)
    {
        HANDLE hMutex = ::CreateMutex(NULL, FALSE, "Mutex");
        WaitForSingleObject(hMutex, INFINITE);
        cout<<"in"<<endl;
        Sleep(2000);
        cout<<"out"<<endl;
        ReleaseMutex(hMutex);
    }
}

相关文章:

  • 2022-12-23
  • 2021-08-31
  • 2022-12-23
  • 2021-06-11
  • 2021-06-07
  • 2022-01-21
  • 2018-04-11
  • 2019-07-21
猜你喜欢
  • 2021-11-19
  • 2022-12-23
  • 2021-12-11
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案