X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fapplication.cpp;h=a9aa88ea55bdee578d81238d614120a962be2173;hp=22c8d2688310685fb2aaeb4e30857256bcc7c062;hb=727f8ce40806cc2f7c295260f3c9aa156c815c70;hpb=a883560b42163f5ed0c83204469d17dd4f0134b6 diff --git a/source/application.cpp b/source/application.cpp index 22c8d26..a9aa88e 100644 --- a/source/application.cpp +++ b/source/application.cpp @@ -19,7 +19,9 @@ Poller::Slot &Application::add_pollable(Pollable *obj, short events) Poller::Slot &slot=poller_->add_pollable(obj, events); // Interrupt a possible poll in progress - pthread_kill(main_tid, SIGALRM); +#ifndef WIN32 //XXX + pthread_kill(main_tid, SIGALRM); +#endif return slot; } @@ -62,7 +64,9 @@ int Application::run(int argc, char **argv) return 126; } +#ifndef WIN32 //XXX signal(SIGALRM, &sigalrm_); +#endif try { @@ -91,6 +95,17 @@ void Application::usage(const char *, bool) cerr<<"The programmer was lazy and didn't write a usage() function for this application.\n"; } +Application::Application(): + exit_code(0), + tick_mode_(IDLE), + poller_(0), + ev_mgr_(0) +#ifndef WIN32 + //XXX Figure out how to get the current thread on win32 + ,main_tid(pthread_self()) +#endif +{ } + /** Default main loop. Calls tick() periodically if do_ticks is true, otherwise just sleeps. A custom main loop should monitor the done member variable and @@ -106,7 +121,11 @@ int Application::main() if(poller_) poller_->poll(0); tick(); +#ifdef WIN32 + Sleep(0); +#else sched_yield(); +#endif } else { @@ -140,7 +159,9 @@ void Application::catch_signal(int s) void Application::set_tick_mode(TickMode t) { tick_mode_=t; +#ifndef WIN32 //XXX pthread_kill(main_tid, SIGALRM); +#endif } /** @@ -150,7 +171,9 @@ void Application::exit(int c) { done=true; exit_code=c; +#ifndef WIN32 //XXX pthread_kill(main_tid, SIGALRM); +#endif } void Application::sighandler_(int s)