Skip to content

Instantly share code, notes, and snippets.

@yifu
Created September 18, 2012 15:12
Show Gist options
  • Select an option

  • Save yifu/3743677 to your computer and use it in GitHub Desktop.

Select an option

Save yifu/3743677 to your computer and use it in GitHub Desktop.
ACE tests
#include <ace/Reactor.h>
#include <iostream>
using namespace std;
// --------------------------------------------------
// The goal is testing the shedule_timer() function
// correctly triggers an event.
// --------------------------------------------------
// -------------------------------------------
struct test_handler : public ACE_Event_Handler
{
int handle_timeout(const ACE_Time_Value& current_time, const void* act = 0);
};
// -------------------------------------------
int test_handler::handle_timeout(const ACE_Time_Value& current_time, const void* act)
{
cout << "here" << endl;
}
// -------------------------------------------
int main()
{
test_handler handler;
ACE_Time_Value delay(2);
ACE_Reactor::instance()->schedule_timer(&handler, (void *)0/*arg*/, delay, ACE_Time_Value(0));
return ACE_Reactor::instance()->run_event_loop();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment