Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1445

I totally forgot that Delphi has had a function to get the current executing thread – Stack Overflow

$
0
0

While updating some old code fiddling with the[WayBackGetThreadId function, I wanted to have some TThread wrapper around it. I had totally forgotten there has been already a means for this since Delphi 2009 (which initially had a bug, but that was worked around at first and fixed later): [WayBackCurrentThread.

The latest version of Delphi, Delphi 2009, has a CurrentThread class property on the TThread class.

This will return the proper Delphi thread object if it’s a native thread. If the thread is an “alien” thread, i.e. created using some other mechanism or on a callback from a third party thread, then it will create a wrapper thread around the thread handle.

20081001 at 5:00 – [WayBackBarry Kelly

Sources

–jeroen


Viewing all articles
Browse latest Browse all 1445

Trending Articles