On 5/26/23 16:52, Peter Zijlstra wrote:
By popular demand, a new and improved version :-)
New since -v1 ( https://lkml.kernel.org/r/20230526150549.250372621@xxxxxxxxxxxxx )
- much improved interface for lock guards: guard() and scoped () { }
as suggested by Linus.
<name bikeshedding>
I know I'm the one who hinted at C++ "std::scoped_lock" as a similar
preexisting API, but I find that "scoped()" is weird in the newly
proposed form. "scoped_lock" is fine considering that "scoped" is an
adjective applying to "lock", but in the case of e.g. scoped(rcu) { },
then we are really declaring a "scope" of type "rcu". I suspect that in
this case:
scope(rcu) { }
would be less unexpected than the adjective form:
scoped(rcu) { }
Especially if we go for the name "guard()", rather than the adjective
guarded(), for its counterpart.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com