I am using a mutex for the critical section. I have a design constraint that, 1) If 2 reads occur in 2 different thread, then critical section should be available for both. 2) If there is a write happening, then read on other thread should be blocked 3) If there is a read happening, then write on other thread should be blocked.
I dont know to do this with Createmutex, openmutex, waitforsingleobject and releasemutex apis.
What you are looking for is a Reader-Writer lock. There are some implementations of it on the internet, for example this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With