aboutsummaryrefslogtreecommitdiffhomepage
path: root/iothread.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-06 15:12:37 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-03-06 15:12:37 -0800
commit36fe1e4a463560672cbf8cbfbe45b26fcf2a2377 (patch)
treef14e51fd3a7fffd9cabfa4cc08a1d414890102b0 /iothread.cpp
parent9ee4e4e05c46669ed9c254188fd5aa83aa5374f2 (diff)
Some initial work towards cutting down the number of fork calls we do
Diffstat (limited to 'iothread.cpp')
-rw-r--r--iothread.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/iothread.cpp b/iothread.cpp
index dcb79fe1..bcfe4943 100644
--- a/iothread.cpp
+++ b/iothread.cpp
@@ -199,8 +199,14 @@ void iothread_service_completion(void) {
void iothread_drain_all(void) {
ASSERT_IS_MAIN_THREAD();
- ASSERT_IS_NOT_FORKED_CHILD();
+ ASSERT_IS_NOT_FORKED_CHILD();
+ if (s_active_thread_count == 0)
+ return;
+ int thread_count = s_active_thread_count;
+ double now = timef();
while (s_active_thread_count > 0) {
iothread_service_completion();
}
+ double after = timef();
+ printf("(Waited %.02f msec for %d thread(s) to drain)\n", 1000 * (after - now), thread_count);
}