summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)