class · System.Threading

ThreadPool

public class System.Threading.ThreadPool : System.Any

Threads that run queued work: as many as processors, started with the first work item, kept for the program.

Kind
class
Namespace
System.Threading
Assembly
System.Core
Access
public, static, abstract
Source file
Threading.ant

Inheritance

Base classes
Any ThreadPool

Properties

static property ThreadCount: i32
#

static read-only

How many threads run the work.

Methods

static method QueueUserWorkItem(item: func<> : void) -> void
#

static

Runs item on a pool thread (an error it throws ends the program).

Private and internal members (8)

static field mutex: System.Threading.Mutex
#

private static

static field waiting: System.Threading.Condition
#

private static

static field work: System.Queue<func<> : void>
#

private static

static field workers: i32
#

private static

static field idle: i32
#

private static

static field spinning: System.Threading.AtomicI32
#

private static

static method Work() -> void
#

private static

What each worker does: takes work, runs it, again. Before it sleeps it waits a little, giving the processor up in turns: work often comes right after.

static method Begin() -> void
#

private static

Inherited members (5)

Source

ThreadPool as Larva HIR, decompiled from its Larva HIR.

System.Threading.ThreadPool.hir
// Threads that run queued work: as many as processors, started with the first work item, kept for the program.
public class System.Threading.ThreadPool : System.Any
{
    static field mutex: System.Threading.Mutex
    static field waiting: System.Threading.Condition
    static field work: System.Queue<func<> : void>
    static field workers: i32
    static field idle: i32
    static field spinning: System.Threading.AtomicI32
    // What each worker does: takes work, runs it, again. Before it sleeps it waits a little, giving the processor
    // up in turns: work often comes right after.
    static method Work() -> void
    static method Begin() -> void
    // Runs `item` on a pool thread (an error it throws ends the program).
    static method QueueUserWorkItem(item: func<> : void) -> void
    // How many threads run the work.
    static property ThreadCount: i32
}
Esc