Skip to content

Commit

Permalink
Merge pull request #3968 from durban/mutexComment
Browse files Browse the repository at this point in the history
Add explanatory comment to Mutex implementation
  • Loading branch information
djspiewak authored Jan 26, 2024
2 parents 8930ffd + 9035a29 commit 71e9035
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions std/shared/src/main/scala/cats/effect/std/Mutex.scala
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ object Mutex {
)(
implicit F: Concurrent[F]
) extends Mutex[F] {

// This is a variant of the Craig, Landin, and Hagersten
// (CLH) queue lock. Queue nodes (called cells below)
// are `Deferred`s, so fibers can suspend and wake up
// (instead of spinning, like in the original algorithm).

// Awakes whoever is waiting for us with the next cell in the queue.
private def awakeCell(
ourCell: ConcurrentImpl.WaitingCell[F],
Expand Down

0 comments on commit 71e9035

Please sign in to comment.