liveBook · Manning

ReadLock

As explained in Learn Concurrent Programming with Go

ReadLock is a function that acquires the read side of the book's readers-writer mutex implementation.

ReadLock acquires the read side of a readers–writer mutex. Multiple goroutines may enter the shared resource together, while a writer is blocked until every active reader leaves. section 4.2.2

Shared-room model

Imagine readers entering a shared room through one entrance and writers through another. The first reader locks the writers’ entrance; later readers can still enter. ReadUnlock decrements the count and reopens the writers’ entrance when the last reader leaves. section 4.2.2

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains counter updates and mutex ordering, stopping short of broader synchronization policy or performance analysis.
Examples
Uses a shared-room analogy and an annotated Go implementation with readersCounter, readersLock, and globalLock.
What it assumes
Assumes goroutines and mutex-based synchronization while developing the readers–writer mechanism incrementally.
What you can do after
Build it from scratch as the read-entry operation in a readers–writer mutex.
How it connects
Connects goroutines, mutexes, critical sections, readers–writer mutexes, ReadUnlock, and WriteLock.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Concurrent Programming with Go. The section links point to the parts of the book it draws on.