|
al_lock_mutex() locks for both read and writes? |
Chris Katko
Member #1,881
January 2002
|
Shouldn't al_lock_mutex() allow locking separately for reading and writing? ala al_lock_mutex(AL_LOCK_WRITE); al_lock_mutex(AL_LOCK_READ); al_lock_mutex(AL_LOCK_BOTH); -----sig: |
beoran
Member #12,636
March 2011
|
Not quite, it wouldn't be a mutex then. A mutex is to exclude other threads from access to a certain block of code, no matter if the block reads or writes. |
Elias
Member #358
May 2000
|
No, it's just a normal mutex not a read-write lock. You can easily implement a read-write lock using a mutex though. I think a read/write lock would be useful enough to add to Allegro's API, if someone does want to add it. However if you use C++ just use for example std::shared_lock/std::unique_lock. -- |
|