Code Explainers

Code explainers tagged #synchronization

go
package worker
 
import (
	"fmt"

A graceful worker pool in Go

concurrency goroutines channels
Intermediate 7 steps
ruby
class ThreadSafeCounter
  def initialize(initial = 0)
    @count = initial
    @mutex = Mutex.new

A thread-safe counter with Mutex in Ruby

concurrency mutex thread-safety
Intermediate 6 steps
go
package main
 
import "sync"
 

Mutex vs RWMutex in Go

concurrency mutex synchronization
Intermediate 6 steps