+class JCR {
+private:
+ pthread_mutex_t mutex; /* jcr mutex */
+ pthread_mutex_t mutex_auth; /* used during authentication */
+ volatile int32_t _use_count; /* use count */
+ int32_t m_JobType; /* backup, restore, verify ... */
+ int32_t m_JobLevel; /* Job level */
+ bool my_thread_killable; /* can we kill the thread? */
+public:
+ void lock() {P(mutex); };
+ void unlock() {V(mutex); };
+ void lock_auth() {P(mutex_auth);};
+ void unlock_auth() {V(mutex_auth);};
+ void inc_use_count(void) {lock(); _use_count++; unlock(); };
+ void dec_use_count(void) {lock(); _use_count--; unlock(); };
+ int32_t use_count() const { return _use_count; };
+ void init_mutex(void) {
+ pthread_mutex_init(&mutex, NULL);
+ pthread_mutex_init(&mutex_auth, NULL);
+ };
+ void destroy_mutex(void) {
+ pthread_mutex_destroy(&mutex_auth);
+ pthread_mutex_destroy(&mutex);
+ };
+ bool is_internal_job() {return (JobId == 0 || m_JobType == JT_SYSTEM || m_JobType == JT_CONSOLE); };
+ bool is_job_canceled() {return job_canceled(this); };
+ bool is_canceled() {return job_canceled(this); };
+ bool is_incomplete() { return JobStatus == JS_Incomplete; };
+ bool is_JobLevel(int32_t JobLevel) { return JobLevel == m_JobLevel; };
+ bool is_JobType(int32_t JobType) { return JobType == m_JobType; };
+ bool is_JobStatus(int32_t aJobStatus) { return aJobStatus == JobStatus; };
+ void setJobLevel(int32_t JobLevel) { m_JobLevel = JobLevel; };
+ void setJobType(int32_t JobType) { m_JobType = JobType; };
+ void forceJobStatus(int32_t aJobStatus) { JobStatus = aJobStatus; };
+ void setJobStarted();
+ int32_t getJobType() const { return m_JobType; };
+ int32_t getJobLevel() const { return m_JobLevel; };
+ int32_t getJobStatus() const { return JobStatus; };
+ bool no_client_used() const {
+ return (m_JobLevel == L_VIRTUAL_FULL);
+ };
+ bool can_be_stopped(); /* in lib/jcr.c */
+ const char *get_OperationName(); /* in lib/jcr.c */
+ const char *get_ActionName(bool past); /* in lib/jcr.c */
+ void setJobStatus(int JobStatus); /* in lib/jcr.c */
+ bool sendJobStatus(); /* in lib/jcr.c */
+ bool sendJobStatus(int JobStatus); /* in lib/jcr.c */
+ bool JobReads(); /* in lib/jcr.c */
+ void my_thread_send_signal(int sig); /* in lib/jcr.c */
+ void set_killable(bool killable); /* in lib/jcr.c */
+ bool is_killable() const { return my_thread_killable; };
+