Back

LL048

Thread-unsafe global access

Object Pascal — Delphi & Free Pascal
Warning
Reliability

Unsynchronized access to global state from threads causes data races and corruption

unsynchronized access to global state from threads causes data races and corruption.

Why this severity

unsynchronized access to global state from threads causes data races and corruption.


Known false positives

read-only globals initialized once at startup before any threads start.

Remediation example

TThread.Synchronize(nil, procedure
begin
  GlobalCount := GlobalCount + 1;
end);

Reconnecting… Connection lost. Reload