Protect against deadlock when using fam/gamin by adding a small timeout to the peek for events done between add calls. Add alarm to the addwatch call in case the deadlock happens anyway

This commit is contained in:
Jean-Francois Dockes
2011-10-13 15:20:28 +02:00
parent bed77d3095
commit 56fe54412f
2 changed files with 91 additions and 32 deletions
+9 -2
View File
@@ -50,9 +50,16 @@ RclConfig *recollinit(RclInitFlags flags,
// Install signal handler
if (sigcleanup) {
struct sigaction action;
action.sa_handler = sigcleanup;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
for (unsigned int i = 0; i < sizeof(catchedSigs) / sizeof(int); i++)
if (signal(catchedSigs[i], SIG_IGN) != SIG_IGN)
signal(catchedSigs[i], sigcleanup);
if (signal(catchedSigs[i], SIG_IGN) != SIG_IGN) {
if (sigaction(catchedSigs[i], &action, 0) < 0) {
perror("Sigaction failed");
}
}
}
DebugLog::getdbl()->setloglevel(DEBDEB1);