I'm trying to implement my own read/write lock using atomic types. I can easily define exclusive locks, but I fail to create locks for shared reader threads, like SRWLock does (see SRWLock). My question is how to implement locks that can be used in exclusive mode (one reader/writer threads at a time) or in shared mode (multiple reader threads at a time).
I can't use std::mutex
lock because it doesn't support multiple readers. Also I don't use boost, so no shared_mutex
either.
Aucun commentaire:
Enregistrer un commentaire