SemaphoreWrapper/test_main.cpp

33 lines
549 B
C++

#include "SemaphoreWrapper.h"
#include <iostream>
using namespace std;
int main()
{
cout<<"Program Started."<<endl;
ProcessSemaphore s(666,1,2);
cout<<"Status: "<<s.isReady()<<endl;
if(!s.isReady())
{
cout<<"Failed to create. Stop."<<endl;
return 0;
}
cout<<"Start P"<<endl;
s.p();
cout<<"Done P"<<endl;
string x;
getline(cin,x);
cout<<"Start V"<<endl;
s.v();
cout<<"Done V"<<endl;
cout<<"Program Finished. Press any key."<<endl;
getline(cin,x);
return 0;
}