System.Threading Namespace

Namespaces | Classes | Functions | Delegates | Class Delegates | Enumerated Types

The System.Threading namespace contains basic threading support: threads, mutexes and condition variables. It also contains support for processes and fibers.

Examples

This threadFunction example shows how to execute a function in a separate thread. Main function starts a thread that executes the ThreadFunction function, and waits the thread to end by calling the Join member function of the started thread.

This threadSynchronization example shows how to use LockGuard , RecursiveMutex and a ConditionVariable to synchronize threads. The main function starts first the Run member function of the OutputCollector class in a separate thread. Then it queries the number of cores by calling the HardwareConcurrency function, and starts twice as many output threads. The output threads enqueue message lines by calling the EnqueueLine member function of the OutputCollector . Finally main thread Join s the output threads and the output collector thread.

Namespaces

Fibers

Classes

public class ConditionVariable
public class LockGuard<Mtx>
public class Mutex
public class RecursiveMutex
public class SynchronizedQueue<T>
public abstract class SynchronizedQueueBase
public class Thread

Functions

public int HardwareConcurrency()

Delegates

public delegate void ParameterizedThreadStartFunction(void * param)
public delegate bool Predicate(void * arg)
public delegate void ThreadStartFunction()

Class Delegates

public class delegate void ParameterizedThreadStartMethod(void * param)
public class delegate bool PredicateMethod(void * arg)
public class delegate void ThreadStartMethod()

Enumerated Types

public enum ConditionVariableStatus

Function Details

HardwareConcurrency Function

public int HardwareConcurrency()

Definition
Line 23 of System.Base/Thread.cm