string getName() const { return "RW lock shared"; }
void operator()() const {
- for (size_t idx = 0; idx < 1000; ) {
+ for (size_t idx = 0; idx < 1000; idx++) {
ReadLock wl(d_lock);
- ++idx;
}
}
string getName() const { return "RW lock exclusive"; }
void operator()() const {
- for (size_t idx = 0; idx < 1000; ) {
+ for (size_t idx = 0; idx < 1000; idx++) {
WriteLock wl(d_lock);
- ++idx;
}
}
string getName() const { return "RW lock try exclusive - " + std::string(d_contended ? "contended" : "non-contended"); }
void operator()() const {
- for (size_t idx = 0; idx < 1000; ) {
+ for (size_t idx = 0; idx < 1000; idx++) {
TryWriteLock wl(d_lock);
if (!wl.gotIt() && !d_contended) {
cerr<<"Error getting the lock"<<endl;
cerr<<"Got a contended lock"<<endl;
_exit(0);
}
- ++idx;
}
}
string getName() const { return "RW lock try shared - " + std::string(d_contended ? "contended" : "non-contended"); }
void operator()() const {
- for (size_t idx = 0; idx < 1000; ) {
+ for (size_t idx = 0; idx < 1000; idx++) {
TryReadLock wl(d_lock);
if (!wl.gotIt() && !d_contended) {
cerr<<"Error getting the lock"<<endl;
cerr<<"Got a contended lock"<<endl;
_exit(0);
}
- ++idx;
}
}