Backport #25221
closed
- Copied from Bug #25007: common: Cond.h:C_SaferCond does not check done before calling cond.WaitInterval, creating a race condition added
- Status changed from New to Need More Info
- Assignee set to Prashant D
Should we add wait_for to backport 25007 changes to luminous ?
$ git diff
diff --cc src/common/Cond.h
index aa53b60f23,949f293343..0000000000
--- a/src/common/Cond.h
++ b/src/common/Cond.h
@
-194,6 -195,18 +194,21 @
public
cond.Wait(lock);
return rval;
}
+<<<<<<< HEAD
+=======
+ /// Wait until the \c secs expires or \c complete() is called
+ int wait_for(double secs) {
+ utime_t interval;
+ interval.set_from_double(secs);
+ Mutex::Locker l{lock};
+ if (done) {
+ return rval;
+ }
+ cond.WaitInterval(lock, interval);
+ return done ? rval : ETIMEDOUT;
+ }
++>>>>>>> 7090ea24dd... common: check completion condition before waiting
};
- Assignee deleted (
Prashant D)
- Status changed from Need More Info to Rejected
Also available in: Atom
PDF