summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Sehmisch <tmw@crushnet.org>2006-05-03 14:07:12 +0000
committerPhilipp Sehmisch <tmw@crushnet.org>2006-05-03 14:07:12 +0000
commitc01baa046b6cfdfe8da438d3e60d6cfa141a674f (patch)
tree08c3c01db93f2e70622f1e6e5ca1b0f1205a7133 /src
parent5dba20c49e27d3e3a6aecd35789dc8a90e26fc23 (diff)
downloadmanaserv-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')
-rw-r--r--src/main.cpp10
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)