Skip to content

Polling

Category: Scheduling · Status: stub

One line: Asking repeatedly whether something is ready instead of being told; in Rust, an executor polls a future and the future answers Ready or Pending.

Also called: poll.

How it connects

flowchart LR
  n_async_runtime["Async runtime (executor and reactor)"]
  n_polling["Polling"]
  n_async_runtime -->|uses| n_polling
  classDef center stroke-width:3px
  class n_polling center
  classDef outside stroke-dasharray: 4 3
  class n_async_runtime outside

In each language

Rust Future::poll returns Poll::Ready or Poll::Pending, and a Waker says when to poll again
Go A select with a default case ↗ checks channels without blocking
C++ std::future::wait_for with a zero timeout asks whether a result is ready
Java Future.isDone, and poll on a BlockingQueue
Python Popen.poll checks whether a child process has ended
The operating system poll(2), despite its name, waits for a file descriptor to become ready

Where to read more