#include "config.h"
#include <errno.h>
#include <stdio.h>
-#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <assert.h>
#include <fcntl.h>
#include "system/time.h"
+#include "system/filesys.h"
#include "pthreadpool.h"
#include "lib/util/dlinklist.h"
* 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;
if (nread != sizeof(int)) {
return EINVAL;
}
- return result;
+ *jobid = ret_jobid;
+ return 0;
}
/*