diff options
author | Philipp Sehmisch <tmw@crushnet.org> | 2006-05-03 14:07:12 +0000 |
---|---|---|
committer | Philipp Sehmisch <tmw@crushnet.org> | 2006-05-03 14:07:12 +0000 |
commit | c01baa046b6cfdfe8da438d3e60d6cfa141a674f (patch) | |
tree | 08c3c01db93f2e70622f1e6e5ca1b0f1205a7133 /src/main.cpp | |
parent | 5dba20c49e27d3e3a6aecd35789dc8a90e26fc23 (diff) | |
download | manaserv-c01baa046b6cfdfe8da438d3e60d6cfa141a674f.tar.gz manaserv-c01baa046b6cfdfe8da438d3e60d6cfa141a674f.tar.bz2 manaserv-c01baa046b6cfdfe8da438d3e60d6cfa141a674f.tar.xz manaserv-c01baa046b6cfdfe8da438d3e60d6cfa141a674f.zip |
only yield main thread when there isn't anything to do.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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) |