summaryrefslogtreecommitdiffstats
path: root/src/rccexternal.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2006-01-09 21:30:43 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2006-01-09 21:30:43 +0000
commitd480558fe8a2de12be4fcd9a1bdd1b71c233787b (patch)
tree78f730b1e865dc1b0d53e005bfe03cf834abeae3 /src/rccexternal.c
parent690b7da850a2a241ca220b21938ec114c919d87b (diff)
downloadlibrcc-d480558fe8a2de12be4fcd9a1bdd1b71c233787b.tar.gz
librcc-d480558fe8a2de12be4fcd9a1bdd1b71c233787b.tar.bz2
librcc-d480558fe8a2de12be4fcd9a1bdd1b71c233787b.tar.xz
librcc-d480558fe8a2de12be4fcd9a1bdd1b71c233787b.zip
Fixed lockup on exit
- Fixed lockup on exit (Waiting rccexternal exit forever)
Diffstat (limited to 'src/rccexternal.c')
-rw-r--r--src/rccexternal.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/rccexternal.c b/src/rccexternal.c
index 6a81c56..be9f97d 100644
--- a/src/rccexternal.c
+++ b/src/rccexternal.c
@@ -79,13 +79,25 @@ int rccExternalInit() {
}
void rccExternalFree() {
+ int retry;
+ pid_t res;
+ struct timespec timeout = { 0, 5000000 };
+
if (pid == (pid_t)-1) return;
-
- rccExternalConnect(0);
- if (addr) free(addr);
- waitpid(pid, NULL, 0);
+ for (retry = 0; retry < 3; retry++) {
+ rccExternalConnect(0);
+
+ nanosleep(&timeout, NULL);
+
+ res = waitpid(pid, NULL, WNOHANG);
+ if (res) break;
+ else timeout.tv_nsec*10;
+ }
+
pid = (pid_t)-1;
+ if (addr) free(addr);
+
}
static int rccExternalSetDeadline(struct timeval *tv, unsigned long timeout) {