#include "ace/Task.h"
#include <ace/Manual_Event.h>
#include <ace/Auto_Event.h>
#include "ace/OS.h"
#include <ace/Date_Time.h>
#include <iostream>
using namespace std;
#pragma comment(lib,"aced")
/**
* if MANUAL reset
* sleep till the event becomes signaled
* event remains signaled after wait() completes.
* else AUTO reset
* sleep till the event becomes signaled
* event resets wait() completes.
*/
//ACE_Manual_Event mevent;
ACE_Auto_Event auto_event;
class TaskTest : public ACE_Task_Base
{
public:
int svc()
{
cout << "task base test" << endl;
ACE_Date_Time dt;
cout << "y = " << dt.year() << endl;
cout << "m = " << dt.month() << endl;
cout << "s = " << dt.second() << endl;
ACE_OS::sleep(2);
//mevent.signal();
auto_event.signal();
return 0;
}
protected:
private:
};
int main(int argc, char* argv[])
{
TaskTest tt;
tt.activate();
//mevent.wait();
auto_event.wait();
tt.wait();
return 0;
}