Change the signature of pthreadpool_finished_job() to return 0
[mat/samba.git] / source3 / lib / pthreadpool / pthreadpool.c
index 42b550d7ed7567f0b7d2f636481f008f871e90cb..fffbd050dffdf5f398c49d7343acc24c7bda9bd7 100644 (file)
@@ -20,7 +20,6 @@
 #include "config.h"
 #include <errno.h>
 #include <stdio.h>
-#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
@@ -28,6 +27,7 @@
 #include <assert.h>
 #include <fcntl.h>
 #include "system/time.h"
+#include "system/filesys.h"
 
 #include "pthreadpool.h"
 #include "lib/util/dlinklist.h"
@@ -285,16 +285,16 @@ static void pthreadpool_join_children(struct pthreadpool *pool)
  * Fetch a finished job number from the signal pipe
  */
 
-int pthreadpool_finished_job(struct pthreadpool *pool)
+int pthreadpool_finished_job(struct pthreadpool *pool, int *jobid)
 {
-       int result;
+       int ret_jobid;
        ssize_t nread;
 
        nread = -1;
        errno = EINTR;
 
        while ((nread == -1) && (errno == EINTR)) {
-               nread = read(pool->sig_pipe[0], &result, sizeof(int));
+               nread = read(pool->sig_pipe[0], &ret_jobid, sizeof(int));
        }
        if (nread == -1) {
                return errno;
@@ -302,7 +302,8 @@ int pthreadpool_finished_job(struct pthreadpool *pool)
        if (nread != sizeof(int)) {
                return EINVAL;
        }
-       return result;
+       *jobid = ret_jobid;
+       return 0;
 }
 
 /*