Multi-Threading

  1. Base.Threads.@threads
  2. Base.Threads.foreach
  3. Base.Threads.@spawn
  4. Base.Threads.threadid
  5. Base.Threads.nthreads

同步

  1. Base.Threads.Condition
  2. Base.Threads.Event

另见 同步

原子操作

  1. Base.@atomic
  2. Base.@atomicswap
  3. Base.@atomicreplace

!!! note

  1. The following APIs are fairly primitive, and will likely be exposed through an `unsafe_*`-like wrapper.
  1. Core.Intrinsics.atomic_pointerref(pointer::Ptr{T}, order::Symbol) --> T
  2. Core.Intrinsics.atomic_pointerset(pointer::Ptr{T}, new::T, order::Symbol) --> pointer
  3. Core.Intrinsics.atomic_pointerswap(pointer::Ptr{T}, new::T, order::Symbol) --> old
  4. Core.Intrinsics.atomic_pointermodify(pointer::Ptr{T}, function::(old::T,arg::S)->T, arg::S, order::Symbol) --> old
  5. Core.Intrinsics.atomic_pointerreplace(pointer::Ptr{T}, expected::Any, new::T, success_order::Symbol, failure_order::Symbol) --> (old, cmp)

!!! warning

  1. The following APIs are deprecated, though support for them is likely to remain for several releases.
  1. Base.Threads.Atomic
  2. Base.Threads.atomic_cas!
  3. Base.Threads.atomic_xchg!
  4. Base.Threads.atomic_add!
  5. Base.Threads.atomic_sub!
  6. Base.Threads.atomic_and!
  7. Base.Threads.atomic_nand!
  8. Base.Threads.atomic_or!
  9. Base.Threads.atomic_xor!
  10. Base.Threads.atomic_max!
  11. Base.Threads.atomic_min!
  12. Base.Threads.atomic_fence

ccall using a threadpool (Experimental)

  1. Base.@threadcall

Low-level synchronization primitives

These building blocks are used to create the regular synchronization objects.

  1. Base.Threads.SpinLock