diff options
Diffstat (limited to 'nopsyncd/nopsyncd.c')
-rw-r--r-- | nopsyncd/nopsyncd.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/nopsyncd/nopsyncd.c b/nopsyncd/nopsyncd.c index d478b18..f216d1e 100644 --- a/nopsyncd/nopsyncd.c +++ b/nopsyncd/nopsyncd.c @@ -121,6 +121,10 @@ void* main_loop(void* file) printf("%s returned with %d\n", (char*)file, ret); lua_close(L); + + /* this should bring down the other thread as well + at least this is true for the tcp-server thread */ + pipe_close(); pthread_exit(NULL); } @@ -142,6 +146,7 @@ int main(int argc, char* argv[]) fprintf(stderr, "Error creating qlistener thread (code: %d)\n", ret); return 1; } + pthread_detach(qlistener); /* can't kill this thread so don't join to it */ ret = pthread_create(&tcpserver, NULL, main_loop, "tcpserver.lua"); if(ret) { @@ -149,16 +154,10 @@ int main(int argc, char* argv[]) return 1; } - pthread_join(qlistener, NULL); +/* this thread can't be cancelled so don't wait for it */ +/* pthread_join(qlistener, NULL); */ pthread_join(tcpserver, NULL); - ret = pipe_close(); - if(ret) { - fprintf(stderr, "Error destroying pipe: %s\n", strerror(errno)); - return 1; - } - - printf("stopping nopsyncd.\n"); return 0; } |