Поделиться через


reader_writer_lock::lock Method

Acquires the reader-writer lock as a writer.

_CRTIMP void lock();

Remarks

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

Once a writer attempts to acquire the lock, any future readers will block until the writers have successfully acquired and released the lock. This lock is biased towards writers and can starve readers under a continuous load of writers.

Writers are chained so that a writer exiting the lock releases the next writer in line.

If the lock is already held by the calling context, an improper_lock exception will be thrown.

Requirements

Header: concrt.h

Namespace: Concurrency

See Also

Reference

reader_writer_lock Class

reader_writer_lock::unlock Method