Commit a384ca9d authored by Elvin Sindrilaru's avatar Elvin Sindrilaru

COMMON: Simplify call to try_lock_for

parent 82ebc287
......@@ -361,7 +361,7 @@ RWMutex::LockWrite()
std::terminate();
} else {
// fprintf(stderr,"==== WRITE LOCK PENDING ==== TID=%llu OBJECT=%llx\n",
// (unsigned long long)XrdSysThread::ID(), (unsigned long long)this);
// (unsigned long long)XrdSysThread::ID(), (unsigned long long)this);
XrdSysTimer msSleep;
msSleep.Wait(500);
}
......@@ -909,10 +909,10 @@ RWMutex::EstimateLatenciesAndCompensation(size_t loopsize)
timingLatency = EstimateTimingAddedLatency(loopsize);
orderCheckingLatency = EstimateOrderCheckingAddedLatency(3, loopsize);
lockUnlockDuration = EstimateLockUnlockDuration(loopsize);
//std::cerr<< " timing compensation = "<<timingCompensation<<std::endl;
//std::cerr<< " timing latency = "<<timingLatency<<std::endl;
//std::cerr<< " order latency = "<<orderCheckingLatency<<std::endl;
//std::cerr<< " lock/unlock duration = "<<lockUnlockDuration<<std::endl;
std::cerr << " timing compensation = " << timingCompensation << std::endl;
std::cerr << " timing latency = " << timingLatency << std::endl;
std::cerr << " order latency = " << orderCheckingLatency << std::endl;
std::cerr << " lock/unlock duration = " << lockUnlockDuration << std::endl;
}
//------------------------------------------------------------------------------
......
......@@ -85,9 +85,7 @@ SharedMutex::UnLockWrite()
int
SharedMutex::TimedWrLock(uint64_t timeout_ns)
{
std::chrono::nanoseconds ns(timeout_ns);
if (mSharedMutex.try_lock_for(ns)) {
if (mSharedMutex.try_lock_for(std::chrono::nanoseconds(timeout_ns))) {
return 0;
} else {
return ETIMEDOUT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment