diff options
author | Jeremy Allison <jra@samba.org> | 2011-12-21 20:38:32 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-12-22 12:12:33 +0100 |
commit | 711c18c2301d1bea35cac1144080a94e6b89be27 (patch) | |
tree | 0ead0dba686289a6a6ffb92a58d9120d8d97deb3 /source3/lib/pthreadpool/tests.c | |
parent | 8303d163cf34d0b61bfbbc62e497f7b444a17e10 (diff) | |
download | samba-711c18c2301d1bea35cac1144080a94e6b89be27.tar.gz samba-711c18c2301d1bea35cac1144080a94e6b89be27.tar.bz2 samba-711c18c2301d1bea35cac1144080a94e6b89be27.zip |
Change the signature of pthreadpool_finished_job() to return 0
on success, errno on fail and return the jobid in a separate variable.
I need this fix for my vfs_aio_pthread.c module.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Dec 22 12:12:33 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/lib/pthreadpool/tests.c')
-rw-r--r-- | source3/lib/pthreadpool/tests.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/lib/pthreadpool/tests.c b/source3/lib/pthreadpool/tests.c index 667ee01784..95d37b6f17 100644 --- a/source3/lib/pthreadpool/tests.c +++ b/source3/lib/pthreadpool/tests.c @@ -68,12 +68,13 @@ static int test_jobs(int num_threads, int num_jobs) } for (i=0; i<num_jobs; i++) { - ret = pthreadpool_finished_job(p); - if ((ret < 0) || (ret >= num_jobs)) { - fprintf(stderr, "invalid job number %d\n", ret); + int jobid = -1; + ret = pthreadpool_finished_job(p, &jobid); + if ((ret != 0) || (jobid >= num_jobs)) { + fprintf(stderr, "invalid job number %d\n", jobid); return -1; } - finished[ret] += 1; + finished[jobid] += 1; } for (i=0; i<num_jobs; i++) { @@ -275,18 +276,19 @@ static int test_threaded_addjob(int num_pools, int num_threads, int poolsize, } for (j=0; j<num_pools; j++) { + int jobid = -1; if ((pfds[j].revents & (POLLIN|POLLHUP)) == 0) { continue; } - ret = pthreadpool_finished_job(pools[j]); - if ((ret < 0) || (ret >= num_jobs * num_threads)) { + ret = pthreadpool_finished_job(pools[j], &jobid); + if ((ret != 0) || (jobid >= num_jobs * num_threads)) { fprintf(stderr, "invalid job number %d\n", - ret); + jobid); return -1; } - finished[ret] += 1; + finished[jobid] += 1; received += 1; } } |