Sign in Join
FPDoc Onlineexperiment

TThread.SpinWait procedure

Member of TThreadpublicIn unit Classes

Prevent thread execution in a spin-wait loop.

Declaration

pascal
class procedure SpinWait(aIterations: LongWord); static

Description

SpinWait blocks the execution of the thread in a spin-wait loop: it simply executes some simple instructions.

This can be used to create short time delays without an immediate thread switch (e.g. Sleep can cause a thread switch). The input parameter (aIterations) specifies the number of spin loops.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.