Win32 Read/Write Lock Using Only Critical Sections

前端 未结 10 1347
攒了一身酷
攒了一身酷 2020-12-14 12:20

I have to implement a read/write lock in C++ using the Win32 api as part of a project at work. All of the existing solutions use kernel objects (semaphores and mutexes) tha

10条回答
  •  轮回少年
    2020-12-14 12:58

    If you already know of a solution that only uses mutexes, you should be able to modify it to use critical sections instead.

    We rolled our own using two critical sections and some counters. It suits our needs - we have a very low writer count, writers get precedence over readers, etc. I'm not at liberty to publish ours but can say that it is possible without mutexes and semaphores.

提交回复
热议问题