/*
Bacula® - The Network Backup Solution
- Copyright (C) 2003-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2003-2009 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
*
* Kern Sibbald, July MMIII
*
- * Version $Id$
*
* This code was adapted from the Bacula workq, which was
* adapted from "Programming with POSIX Threads", by
Dmsg0(2300, "Create worker thread\n");
/* No idle threads so create a new one */
set_thread_concurrency(jq->max_workers + 1);
+ jq->num_workers++;
if ((stat = pthread_create(&id, &jq->attr, jobq_server, (void *)jq)) != 0) {
berrno be;
+ jq->num_workers--;
Jmsg1(NULL, M_ERROR, 0, _("pthread_create: ERR=%s\n"), be.bstrerror(stat));
return stat;
}
set_jcr_in_tsd(INVALID_JCR);
Dmsg0(2300, "Start jobq_server\n");
P(jq->mutex);
- jq->num_workers++;
for (;;) {
struct timeval tv;
V(jq->mutex);
/* Call user's routine here */
- Dmsg2(2300, "Calling user engine for jobid=%d use=%d\n", jcr->JobId,
- jcr->use_count());
+ Dmsg3(2300, "Calling user engine for jobid=%d use=%d stat=%c\n", jcr->JobId,
+ jcr->use_count(), jcr->JobStatus);
jq->engine(je->jcr);
/* Job finished detach from thread */