module Sync
Overview
Synchronization primitives to build concurrent-safe and parallel-safe data structures, so we can embrace concurrency and parallelism with more serenity.
Communication through aChannel should be preferred whenever possible, but
sometimes we need to protect critical sections manually, for example to build
higher level constructs, or to protect a mutable global constant:
Sync::Mutexto protect critical sections using mutual exclusion.Sync::RWLockto protect critical sections using shared access and mutual exclusion.Sync::ConditionVariableto synchronize critical sections together.Sync::Exclusive(T)to protect a valueTusing mutual exclusion.Sync::Shared(T)to protect a valueTusing a mix of shared access and mutual exclusion.
Defined in:
sync/condition_variable.crsync/cv.cr
sync/errors.cr
sync/exclusive.cr
sync/lockable.cr
sync/mu.cr
sync/mutex.cr
sync/rw_lock.cr
sync/shared.cr
sync/sync.cr
sync/type.cr
sync/waiter.cr