Browse Source

Moved sem_close() further to the end.

default 1 year ago
parent
commit
6bad2355ef
1 changed files with 2 additions and 4 deletions
  1. 2 4
      httpd.c

+ 2 - 4
httpd.c

@@ -354,10 +354,6 @@ void job_wait(xs_val **job)
         /* unlock the mutex */
         pthread_mutex_unlock(&job_mutex);
     }
-
-    if (!*job) {
-        sem_close(job_sem);
-    }
 }
 
 
@@ -568,5 +564,7 @@ void httpd(void)
     job_fifo = xs_free(job_fifo);
     pthread_mutex_unlock(&job_mutex);
 
+    sem_close(job_sem);
+
     srv_log(xs_fmt("httpd stop %s:%d", address, port));
 }