This documentation is archived and is not being maintained.

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.

_CRTIMP void lock_read();

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.

Header: concrt.h

Namespace: Concurrency

Show: