}
int Lock() {
- if (tag) cout << this << " " << pthread_self() << endl;
+ int t = tag;
+ if (t) cout << this << " " << pthread_self() << endl;
int r = pthread_mutex_lock(&M);
- if (tag) cout << "lock = " << r << endl;
+ if (t) cout << "lock = " << r << endl;
return r;
}
int Unlock()
{
- if (tag) cout << this << " " << pthread_self() << endl;
+ int t = tag;
+ if (t) cout << this << " " << pthread_self() << endl;
int r = pthread_mutex_unlock(&M);
- if (tag) cout << "lock = " << r << endl;
+ if (t) cout << "lock = " << r << endl;
return r;
}
sent_ack(false), sent_safe(false),
new_version(nv), old_version(ov)
{ }
- bool can_send_ack() { return !sent_ack && //!cancel &&
+ bool can_send_ack() { return !sent_ack && !sent_safe && //!cancel &&
waitfor_ack.empty(); }
bool can_send_safe() { return !sent_safe && //!cancel &&
waitfor_ack.empty() && waitfor_safe.empty(); }