Changeset 746 for vendor/current/source3/lib/pthreadpool
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- Location:
- vendor/current/source3/lib/pthreadpool
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/lib/pthreadpool/pthreadpool.c
r740 r746 285 285 */ 286 286 287 int pthreadpool_finished_job(struct pthreadpool *pool )288 { 289 int re sult;287 int pthreadpool_finished_job(struct pthreadpool *pool, int *jobid) 288 { 289 int ret_jobid; 290 290 ssize_t nread; 291 291 … … 294 294 295 295 while ((nread == -1) && (errno == EINTR)) { 296 nread = read(pool->sig_pipe[0], &re sult, sizeof(int));296 nread = read(pool->sig_pipe[0], &ret_jobid, sizeof(int)); 297 297 } 298 298 if (nread == -1) { … … 302 302 return EINVAL; 303 303 } 304 return result; 304 *jobid = ret_jobid; 305 return 0; 305 306 } 306 307 -
vendor/current/source3/lib/pthreadpool/pthreadpool.h
r740 r746 91 91 * 92 92 * @param[in] pool The pool to query for finished jobs 93 * @return The job_id of the finished job 93 * @param[out] pjobid The job_id of the finished job 94 * @return success: 0, failure: errno 94 95 */ 95 int pthreadpool_finished_job(struct pthreadpool *pool );96 int pthreadpool_finished_job(struct pthreadpool *pool, int *jobid); 96 97 97 98 #endif -
vendor/current/source3/lib/pthreadpool/tests.c
r740 r746 69 69 70 70 for (i=0; i<num_jobs; i++) { 71 ret = pthreadpool_finished_job(p); 72 if ((ret < 0) || (ret >= num_jobs)) { 73 fprintf(stderr, "invalid job number %d\n", ret); 74 return -1; 75 } 76 finished[ret] += 1; 71 int jobid = -1; 72 ret = pthreadpool_finished_job(p, &jobid); 73 if ((ret != 0) || (jobid >= num_jobs)) { 74 fprintf(stderr, "invalid job number %d\n", jobid); 75 return -1; 76 } 77 finished[jobid] += 1; 77 78 } 78 79 … … 276 277 277 278 for (j=0; j<num_pools; j++) { 279 int jobid = -1; 278 280 279 281 if ((pfds[j].revents & (POLLIN|POLLHUP)) == 0) { … … 281 283 } 282 284 283 ret = pthreadpool_finished_job(pools[j] );284 if ((ret < 0) || (ret>= num_jobs * num_threads)) {285 ret = pthreadpool_finished_job(pools[j], &jobid); 286 if ((ret != 0) || (jobid >= num_jobs * num_threads)) { 285 287 fprintf(stderr, "invalid job number %d\n", 286 ret);288 jobid); 287 289 return -1; 288 290 } 289 finished[ ret] += 1;291 finished[jobid] += 1; 290 292 received += 1; 291 293 }
Note:
See TracChangeset
for help on using the changeset viewer.