Espacio de nombres · Larva HIR

System.Threading

Tipos

class AtomicBool A bool that threads change together.
class AtomicI32 An i32 that threads change together (each operation is atomic).
class AtomicI64 An i64 that threads change together (as AtomicI32).
class AutoResetEvent An event that lets one waiter through each time it is set (and resets itself).
class BlockingCollection<T> A queue that hands items from producers to consumers: Take waits for an item; after CompleteAdding, Take on an empty queue throws and TryTake gives false.
class ConcurrentQueue<T> A queue several threads use at once (a lock around a Queue).
class Condition Waiting until another thread says something changed: Wait releases the mutex (which the caller holds) while it waits and takes it back before it returns.
class CountdownEvent Set once it has been signaled initialCount times: Wait waits for that.
class Interlocked Atomic operations on numbers in memory reached by pointers (unsafe code): Interlocked.Add(&counts[i], 1).
class Lock A lock with the names Enter, Exit and TryEnter.
class ManualResetEvent An event that stays set until Reset: WaitOne returns at once while it is set.
class Mutex A lock: one thread at a time between Lock and Unlock (not re-entrant: a thread that holds it must not lock it again).
class Parallel Loops whose passes run on several threads at once.
class SemaphoreSlim Counts permits: Wait takes one (waiting while there are none), Release gives them back.
class Shared<T> internal A value in an object (what several lambdas share and change).
class Thread A thread of its own running a function: new Thread(() => …), Start, Join.
class ThreadPool Threads that run queued work: as many as processors, started with the first work item, kept for the program.
Esc