summaryrefslogtreecommitdiff
path: root/lib/TaskMan.cc
diff options
context:
space:
mode:
authorNicolas Noble <pixel@Aoshi.local>2008-11-28 17:17:52 -0800
committerNicolas Noble <pixel@Aoshi.local>2008-11-28 17:17:52 -0800
commit647315275bc825d43130a1b62ebd914ae8769d18 (patch)
tree9b147e2769285687001e241cca47a6e1763c4aa2 /lib/TaskMan.cc
parent52283ef0ea74c927be29c31ebe9e21ee5d27c739 (diff)
Adding Darwin support:
-) iconv is broken on Darwin as well -) ppoll doesn't exist under Darwin
Diffstat (limited to 'lib/TaskMan.cc')
-rw-r--r--lib/TaskMan.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc
index e3ebd9a..83fe5aa 100644
--- a/lib/TaskMan.cc
+++ b/lib/TaskMan.cc
@@ -326,7 +326,12 @@ void TaskMan::Init() throw (GeneralException) {
signal(SIGPIPE, taskman_sigpipe);
signal(SIGHUP, taskman_sighup);
signal(SIGUSR1, taskman_sigusr1);
-
+
+#ifdef __APPLE__
+ sigemptyset(&sigchildset);
+ sigaddset(&sigchildset, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigchildset, 0);
+#else
sigset_t sigtempset;
sigemptyset(&sigchildset);
@@ -335,7 +340,8 @@ void TaskMan::Init() throw (GeneralException) {
sigprocmask(SIG_SETMASK, 0, &sigtempset);
sigaddset(&sigtempset, SIGCHLD);
sigprocmask(SIG_SETMASK, &sigtempset, 0);
-#endif
+#endif
+#endif
inited = true;
number = 0;
@@ -683,8 +689,14 @@ void TaskMan::MainLoop() throw (GeneralException) {
bool timeout_condition = no_burst && !Zombies.size() && !got_sigchild && !got_yield;
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__APPLE__)
+#ifdef __APPLE__
+ sigprocmask(SIG_UNBLOCK, &sigchildset, 0);
+#endif
r = poll(ufsd, nfds, timeout_condition ? timeout : 0);
+#ifdef __APPLE__
+ sigprocmask(SIG_BLOCK, &sigchildset, 0);
+#endif
#else
struct timespec ttimeout = { 0, 0 };
if ((timeout != -1) && timeout_condition) {