Commit e8b51398 authored by Mike Hibler's avatar Mike Hibler

This is sooooo embarrassing!

Someone needs to take away my license to multithread...
parent 1a3886b3
...@@ -122,6 +122,7 @@ static pthread_t mainthread; ...@@ -122,6 +122,7 @@ static pthread_t mainthread;
*/ */
static void sigpass(int sig) static void sigpass(int sig)
{ {
static int called = 0;
char tbuf[32]; char tbuf[32];
time_t ts = time(NULL); time_t ts = time(NULL);
pthread_t th = pthread_self(); pthread_t th = pthread_self();
...@@ -129,8 +130,8 @@ static void sigpass(int sig) ...@@ -129,8 +130,8 @@ static void sigpass(int sig)
info("event-sched[%d]: received signal %d in thread %p at %s", info("event-sched[%d]: received signal %d in thread %p at %s",
getpid(), sig, th, ctime_r(&ts, tbuf)); getpid(), sig, th, ctime_r(&ts, tbuf));
/* haven't fired up anything yet, just exit */ /* haven't fired up anything yet or seem to be stuck, just exit */
if (mainthread == NULL) if (mainthread == NULL || ++called > 100)
exit(0); exit(0);
/* whoever we are, we should not process signals after this */ /* whoever we are, we should not process signals after this */
...@@ -139,7 +140,7 @@ static void sigpass(int sig) ...@@ -139,7 +140,7 @@ static void sigpass(int sig)
if (th != mainthread) { if (th != mainthread) {
info("event-sched[%d]: handled signal in wrong thread!", info("event-sched[%d]: handled signal in wrong thread!",
getpid()); getpid());
pthread_kill(th, sig); pthread_kill(mainthread, sig);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment