Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

Location:
trunk/server/source3/lib/pthreadpool
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/lib/pthreadpool/pthreadpool.c

    r745 r751  
    288288 */
    289289
    290 int pthreadpool_finished_job(struct pthreadpool *pool)
    291 {
    292         int result;
     290int pthreadpool_finished_job(struct pthreadpool *pool, int *jobid)
     291{
     292        int ret_jobid;
    293293        ssize_t nread;
    294294
     
    297297
    298298        while ((nread == -1) && (errno == EINTR)) {
    299                 nread = read(pool->sig_pipe[0], &result, sizeof(int));
     299                nread = read(pool->sig_pipe[0], &ret_jobid, sizeof(int));
    300300        }
    301301        if (nread == -1) {
     
    305305                return EINVAL;
    306306        }
    307         return result;
     307        *jobid = ret_jobid;
     308        return 0;
    308309}
    309310
  • trunk/server/source3/lib/pthreadpool/pthreadpool.h

    r745 r751  
    9191 *
    9292 * @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
    9495 */
    95 int pthreadpool_finished_job(struct pthreadpool *pool);
     96int pthreadpool_finished_job(struct pthreadpool *pool, int *jobid);
    9697
    9798#endif
  • trunk/server/source3/lib/pthreadpool/tests.c

    r745 r751  
    6969
    7070        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;
    7778        }
    7879
     
    276277
    277278                for (j=0; j<num_pools; j++) {
     279                        int jobid = -1;
    278280
    279281                        if ((pfds[j].revents & (POLLIN|POLLHUP)) == 0) {
     
    281283                        }
    282284
    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)) {
    285287                                fprintf(stderr, "invalid job number %d\n",
    286                                         ret);
     288                                        jobid);
    287289                                return -1;
    288290                        }
    289                         finished[ret] += 1;
     291                        finished[jobid] += 1;
    290292                        received += 1;
    291293                }
Note: See TracChangeset for help on using the changeset viewer.