Vote UpVote

Delphi threadvar: TLS thread local storage

The Wiert Corner – Managing TLS correctly with all kinds of dynamic storage seems to be a nightmare. From what I think it’s safe to use a TStopWatch [WayBack] System.Diagnostics.TStopwatch (introduced in Delphi XE2) as threadvar (which gets into TLS: Thread-local storage) because it’s a record type and as a bonus will be zero-initialised in something like this: threadvar ThreadStopwatch: TStopwatch; // threadvars are zero-initialised, like TStopwatch.Reset was called. Ensure TStopwatch.InitStopwatchType called before using this. ... thread code: var lThreadElapsedMilliseconds: string; begin ... ...
Favorite? Off-Topic? jpluimers @ 2019-02-07 06:04


Visits: 201
Votes: 1
Favorites: 0
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Bruce McGee
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News


Please login or register to use this functionality.
(click on this box to dismiss)