top | item 47110135

(no title)

gpderetta | 9 days ago

> it's impossible to support the same API as you're used to with std::shared_mutex

If I understand the problem correctly, the standard library could specialize the scoped lock objects for the shared mutex, online allocate the waiter object in the lock (so it will be in the stack) and use an internal dedicated API.

It might be harder (but not impossible) to interoperate threads using direct lock calls with threads using the scoped API.

In any case it is a moot point, as I don't think any std library does it nor will never do as it would probably be ABI breaking.

discuss

order

nly|7 days ago

Yes, The RAII lock_guard pattern is the correct and proper one. But efficient FIFO/scalable locks can't be created using the C POSIX locking API.