aboutsummaryrefslogtreecommitdiffhomepage
path: root/exec.cpp
diff options
context:
space:
mode:
authorGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-27 19:46:15 -0800
committerGravatar ridiculousfish <corydoras@ridiculousfish.com>2012-02-27 19:46:15 -0800
commitcf54ad8242056ae6d686fa6455b24427f4411e18 (patch)
treea1cc4a8bec1d1688114a19b07a1b29e6b7f9b361 /exec.cpp
parentfdfa5c06028d3473f57cea497a6682a8e550352f (diff)
Change to wait for all outstanding iothreads before calling fork(). This should prevent a whole host of threading/fork interactions, but may also compromise performance...we'll see.
Diffstat (limited to 'exec.cpp')
-rw-r--r--exec.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/exec.cpp b/exec.cpp
index 85a3696a..78d64695 100644
--- a/exec.cpp
+++ b/exec.cpp
@@ -34,6 +34,7 @@
#include "fallback.h"
#include "util.h"
+#include "iothread.h"
#include "common.h"
#include "wutil.h"
@@ -833,6 +834,9 @@ static pid_t exec_fork()
{
ASSERT_IS_MAIN_THREAD();
+ /* Make sure we have no outstanding threads before we fork. This is a pretty sketchy thing to do here, both because exec.cpp shouldn't have to know about iothreads, and because the completion handlers may do unexpected things. */
+ iothread_drain_all();
+
pid_t pid;
struct timespec pollint;
int i;