Forum > General
ThreadVar variables.
(1/1)
taazz:
I think I finally found a valid use of a ThreadVar variable but since this is going to be my first attempt to use them I have 2 basic questions.
1) How is a ThreadVar initialized? I plan to use a numeric variable either cardinal or QWord, I need it to be initialized to 0 on all threads accessing it.
2) Can I have threadVar object fields? something along the line of
--- Code: ---type
TMyAwesomelyDumClass
Private
ThreadVar
FMyPerThreadVariable:DWord;
.
.
.
.
function MyPerThreadVar : DWord Read FMyPerThreadVariable write FMyPerThreadVariable; // this can be anything really its here to show some kind of access.
end;
--- End code ---
Keep in mind, I know not what I'm talking about.
Cyrax:
You can't define a threadvar inside a class. You need to place it outside of the class.
See this for more info : http://www.freepascal.org/docs-html/ref/refse24.html
Navigation
[0] Message Index