return pthread_create( &thread_id, NULL, _entry_func, (void*)this );
}
+ bool am_self() {
+ return (pthread_self() == thread_id);
+ }
+
int join(void **prval = 0) {
if (thread_id == 0) return -1; // never started.
int status = pthread_join(thread_id, prval);
rank.unregister_entity(this);
// stop my dispatch thread
- lock.Lock();
- stop = true;
- cond.Signal();
- lock.Unlock();
- dispatch_thread.join();
+ if (dispatch_thread.am_self())
+ stop = true;
+ else {
+ lock.Lock();
+ stop = true;
+ cond.Signal();
+ lock.Unlock();
+ dispatch_thread.join();
+ }
return 0;
}
class OSDOp {
public:
list<ObjectExtent> extents;
+ virtual ~OSDOp() {}
};
class OSDRead : public OSDOp {