Multithreading – does Delphi class variable have global or thread local storage?

My guess is that the class variable ("class var") is a real global variable in storage (that is, an instance of the whole application)

But I want to know if this is the case, or if they are threads in storage (like "threadvar" for example) – one instance per thread

Who knows?

Edit: change "scope" to "storage" because this is actually the correct term and what I pursue (thank Barry)

Solution

Yes, class variables are globally scoped For details on how to implement threadvars, please check the RTL source code Under Win32, each thread can automatically allocate a piece of memory when creating a thread This extra data area is used to contain your threadvars

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>