A read/write lock pattern
or simply RWL
is a software design pattern
that allows concurrent
read access to an object
but requires exclusive access for write operations.
In this pattern, multiple readers can read the data in parallel but an exclusive lock is needed while writing the data. When a writer is writing the data, readers will be blocked until the writer is finished writing.
The current edition of the POSIX standard includes a read-write lock in the form of
pthread_rwlock_t and the associated operations
Java version 5 or above includes an interface named
java.util.concurrent.locks.ReadWriteLock that allows the use of this pattern.
Also, the Boost C++ Libraries include a read/write lock in the form of