Skip to content

Modern Chan WorkerCount

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Goroutines and Channels › Goroutines and Channels › WorkerCount

WorkerCount

Returns how many OS threads the scheduler is running goroutines on.

Syntax

WorkerCount( ) as int32

Notes

  • Distinct from GoroutineCount: many goroutines share few workers.
  • The pool grows when a goroutine blocks, so this can rise under load and is not a constant.
  • A diagnostic, like GoroutineCount -- reading it does not change scheduling.

Examples

#import "std/tasks"
using tasks

print WorkerCount( ) >= 1        '' -1 (true) -- at least one

'' Many goroutines share few workers, so these two numbers answer
'' different questions
print GoroutineCount( ) >= 0     '' -1 (true)

Library: Goroutines and Channels
Category: Goroutines and Channels
Documented under: Members

Clone this wiki locally