Mutex between reading and writing

I use a mutex for a critical section. I have a design limitation, which, 1) If 2 reads occur in 2 different threads, then the critical section should be available for both. 2) If recording is in progress, then reading on another thread should be blocked. 3) If reading is in progress, then recording on another thread should be blocked.

I do not know how to do this using Createmutex, openmutex, waitforsingleobject and releasemutex apis.

+3
source share
3 answers

What you are looking for is Read / Write Lock . There are some implementations on the Internet, such as this one .

+4
0

/ , Mutex. , msdn. msdn, concurrency Windows Api , , . api.

0

All Articles