msg_type = M_ERROR; /* Generate error message */
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
term_msg = _("Backup Canceled");
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
{
jcr->lock();
if ( !jcr->sd_msg_thread_done
- && jcr->SD_msg_chan
+ && jcr->SD_msg_chan_started
&& !pthread_equal(jcr->SD_msg_chan, pthread_self()))
{
Dmsg1(800, "Send kill to SD msg chan jid=%d\n", jcr->JobId);
msg_type = M_ERROR; /* Generate error message */
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
if (wjcr->store_bsock) {
wjcr->store_bsock->signal(BNET_TERMINATE);
- if (wjcr->SD_msg_chan) {
+ if (wjcr->SD_msg_chan_started) {
pthread_cancel(wjcr->SD_msg_chan);
}
}
term_msg = _("%s Canceled");
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
if (wjcr->store_bsock) {
wjcr->store_bsock->signal(BNET_TERMINATE);
- if (wjcr->SD_msg_chan) {
+ if (wjcr->SD_msg_chan_started) {
pthread_cancel(wjcr->SD_msg_chan);
}
}
jcr->inc_use_count(); /* mark in use by msg thread */
jcr->sd_msg_thread_done = false;
- jcr->SD_msg_chan = 0;
+ jcr->SD_msg_chan_started = false;
Dmsg0(150, "Start SD msg_thread.\n");
if ((status=pthread_create(&thid, NULL, msg_thread, (void *)jcr)) != 0) {
berrno be;
Jmsg1(jcr, M_ABORT, 0, _("Cannot create message thread: %s\n"), be.bstrerror(status));
}
/* Wait for thread to start */
- while (jcr->SD_msg_chan == 0) {
+ while (!jcr->SD_msg_chan_started) {
bmicrosleep(0, 50);
if (job_canceled(jcr) || jcr->sd_msg_thread_done) {
return false;
db_end_transaction(jcr, jcr->db); /* terminate any open transaction */
jcr->lock();
jcr->sd_msg_thread_done = true;
- jcr->SD_msg_chan = 0;
+ jcr->SD_msg_chan_started = false;
jcr->unlock();
pthread_cond_broadcast(&jcr->term_wait); /* wakeup any waiting threads */
Dmsg2(100, "=== End msg_thread. JobId=%d usecnt=%d\n", jcr->JobId, jcr->use_count());
pthread_detach(pthread_self());
set_jcr_in_tsd(jcr);
jcr->SD_msg_chan = pthread_self();
+ jcr->SD_msg_chan_started = true;
pthread_cleanup_push(msg_thread_cleanup, arg);
sd = jcr->store_bsock;
pthread_cond_timedwait(&jcr->term_wait, &mutex, &timeout);
V(mutex);
if (jcr->is_canceled()) {
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
jcr->store_bsock->set_timed_out();
jcr->store_bsock->set_terminated();
sd_msg_thread_send_signal(jcr, TIMEOUT_SIGNAL);
msg_type = M_ERROR; /* Generate error message */
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
term_msg = _("Restore Canceled");
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
msg_type = M_ERROR; /* Generate error message */
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
term_msg = _("Backup Canceled");
if (jcr->store_bsock) {
jcr->store_bsock->signal(BNET_TERMINATE);
- if (jcr->SD_msg_chan) {
+ if (jcr->SD_msg_chan_started) {
pthread_cancel(jcr->SD_msg_chan);
}
}
int32_t SDVersion; /* Storage daemon version number */
int64_t spool_size; /* Spool size for this job */
volatile bool sd_msg_thread_done; /* Set when Storage message thread done */
+ bool SD_msg_chan_started; /* Set if message thread started */
bool wasVirtualFull; /* set if job was VirtualFull */
bool IgnoreDuplicateJobChecking; /* set in migration jobs */
bool spool_data; /* Spool data in SD */