reader_writer_lock::lock_read Method

Acquires the reader-writer lock as a reader. If there are writers, active readers have to wait until they are done. The reader simply registers an interest in the lock and waits for writers to release it.

void lock_read();

Remarks

It is often safer to utilize the scoped_lock_read construct to acquire and release a reader_writer_lock object as a reader in an exception safe way.

If there are writers waiting on the lock, the reader will wait until all writers in line have acquired and released the lock. This lock is biased towards writers and can starve readers under a continuous load of writers.

Requirements

Header: concrt.h

Namespace: concurrency

See Also

Reference

reader_writer_lock Class

reader_writer_lock::unlock Method