+class JCR {
+private:
+ pthread_mutex_t mutex; /* jcr mutex */
+ volatile int _use_count; /* use count */
+public:
+ void inc_use_count(void) {P(mutex); _use_count++; V(mutex); };
+ void dec_use_count(void) {P(mutex); _use_count--; V(mutex); };
+ int use_count() { return _use_count; };
+ void init_mutex(void) {pthread_mutex_init(&mutex, NULL); };
+ void destroy_mutex(void) {pthread_mutex_destroy(&mutex); };
+ void lock() {P(mutex); };
+ void unlock() {V(mutex); };
+ bool is_job_canceled() {return job_canceled(this); };
+