From c7824780fafc2ee9ebeaaa34db6d98505e5817eb Mon Sep 17 00:00:00 2001 From: Philippe Pepiot Date: Thu, 15 Apr 2010 20:37:34 +0200 Subject: [PATCH] Fix wait for sleep() when exit --- src/wmfs.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wmfs.c b/src/wmfs.c index 5705126..b868673 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -137,25 +137,22 @@ thread_process(void *arg) XEvent ev; /* X event loop */ - if(!(int*)arg) + if(arg) { while(!exiting && !XNextEvent(dpy, &ev)) getevent(ev); - - pthread_exit(0); } - /* Status checking loop with timing */ else { + pthread_detach(pthread_self()); do { spawn(conf.status_path); sleep(conf.status_timing); } while (!exiting && conf.status_timing != 0); - - pthread_exit(0); } + pthread_exit(NULL); } /** WMFS main loop. @@ -176,7 +173,6 @@ mainloop(void) pthread_create(&evstatus, NULL, thread_process, NULL); (void)pthread_join(evloop, &ret); - (void)pthread_join(evstatus, &ret); } return;