I relative new with delphi XE2, I want to know about something, if I have like this code
TSomeClass=class
strict private
class var
FCounter:integer;
public
class procedure SomeProcedure();static
end;
implementation
class procedure SomeProcedure()
begin
inc(FCounter);
end;
initialization
begin
FCounter:=0;
end;
finalization
begin
FCounter:=0;
end;
As my understanding, SomeProcedure() will static on memory, and single instance,
my question
- if TSomeClass accessed by many thread, TSomeClass thread-safe or not? or it will make overlapping between thread?
- if yes, do I need critical section for each thread? or another approach for that kind of method...
- if two different thread accessed this method, how about FCounter? FCounter will count sequential from last value or different thread with different value start from zero?