[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# TThread.SpinWait

Prevent thread execution in a spin-wait loop

## Declaration

Source position: classesh.inc line 1806

`public class procedure TThread.SpinWait(`
`aIterations: LongWord`
`);`

## 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

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