summaryrefslogtreecommitdiff
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
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.
-rw-r--r--ChangeLog6
-rw-r--r--src/main.cpp10
2 files changed, 10 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 83c7d797..802ac5ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-05-03 Philipp Sehmisch <tmw@crushnet.org>
+ * src/main.cpp: only yield main thread when there isn't anything
+ to do.
+
2006-04-30 Philipp Sehmisch <tmw@crushnet.org>
* src/util/timer.h, src/util/timer.cpp: added a timer class.
* src/main.cpp: replced SDL timing with the new timer class.
@@ -411,4 +415,4 @@
src/dal/sqlitedataprovider.cpp, src/dal/mysqldataprovider.cpp,
src/dal/pqdataprovider.cpp, src/main.cpp, src/client.cpp:
Grammar corrections, and a little bit of work on getting the name
- of the Db. \ No newline at end of file
+ of the Db.
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)