- More precision about my new inventions of scalable algorithms.. - 5 Updates
- Win32: WaitOnAddress vs. WaitForSingleObject - 1 Update
- 2019 wish list - 1 Update
- #include'ing .c files considered harmful? - 2 Updates
- Why should a "c" programmer learn c++ ? (V2) - 1 Update
- Recursive Standard C++ Library Container Types? - 2 Updates
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 19 03:32PM -0800 On 2/19/2021 3:01 PM, Bonita Montero wrote: >> There are implementations that can be starvation free. > No, impossible. Readers can hold the lock as long as they > want and starve out writers. And writers could do the same. Check this out: https://vorbrodt.blog/2019/02/14/read-write-mutex/ On older rwmutex I invented. Its simple, and is starvation free wrt reads and writes. Here is a simple Relacy test unit: __________________________________ // Chris M. Thomassons RW Mutex //#define RL_DEBUGBREAK_ON_ASSERT //#define RL_MSVC_OUTPUT //#define RL_FORCE_SEQ_CST #include <relacy/relacy_std.hpp> #include <cstdio> #include <cstddef> #if ! defined (NDEBUG) # define DBG_PRINTF(e) std::printf e #else # define DBG_PRINTF(e) ((void)0)
Subscribe to:
Post Comments (Atom)
|
No comments:
Post a Comment