From c01baa046b6cfdfe8da438d3e60d6cfa141a674f Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Wed, 3 May 2006 14:07:12 +0000 Subject: only yield main thread when there isn't anything to do. --- src/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index fb0497be..a4114072 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -402,6 +402,11 @@ int main(int argc, char *argv[]) // - Update all active objects/beings state.update(*connectionHandler); } + else { + // when there is nothing to do give away some processor time to + // other tasks + sched_yield(); + }; /*ENetEvent netEvent; @@ -449,11 +454,6 @@ int main(int argc, char *argv[]) break; } }*/ - - // We know only about 10 events will happen per second, - // so give the CPU a break for a while with pthreads sched_yield - // function - sched_yield(); } LOG_INFO("Received: Quit signal, closing down...", 0) -- cgit v1.2.3-70-g09d2