-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
We face many code duplicates of the following form:
if (!lock)
arbitrary_code();
test(lock);
There seems to be no elegant way to avoid writing the whole thing over and over again, we even have to negate the lock by hand.
My idea would be to enable function pointer as parameters, then we could implement it in the following form:
procedure wait_wrapper(function<bool> lock, function<Any> f) {
if (!lock) {f}
test(lock);
}
Reactions are currently unavailable