TThread.SpinWait

Prevent thread execution in a spin-wait loop

Declaration

Source position: classesh.inc line 1961

public 
  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. SysUtils.Sleep can cause a thread switch). The input parameter (aIterations) specifies the number of spin loops.

See also

Name Description
SysUtils.Sleep Suspend execution of a program for a certain time.
TThread.Sleep Prevent thread execution