liveBook · Manning

ReadUnlock

As explained in Learn Concurrent Programming with Go

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

ReadUnlock releases a reader’s share of a read-preferred readers–writer mutex. It decrements the active-reader counter while holding readersLock; when the counter reaches zero, it unlocks globalLock so a waiting writer can proceed. section 4.2.2

The operation follows four steps:

  • Unlock globalLock only when this reader is the last one out. section 4.2.2

How Learn Concurrent Programming with Go covers it

How deep it goes
Explains synchronization, counter management, and final-reader behavior through a complete function implementation.
Examples
Uses a Go listing and a room metaphor where the last reader leaving reopens the writers’ entrance.
What it assumes
Assumes familiarity with ReadLock, WriteLock, shared resources, goroutines, and mutex locking.
What you can do after
Operate/configure a custom readers–writer mutex by releasing read access and allowing a blocked writer to proceed.
How it connects
Connects readers–writer mutexes with ReadLock, WriteLock, WriteUnlock, goroutines, mutexes, and critical sections.

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.