Hey guys! I have a thread. When the thread executes, an infinite while loop starts, which reads a member variable of the class.
The odd thing is that everything is fine to a certain point, where the while loop starts execution in the middle.
the code:
procedure MyThread.Execute;
var
i: Integer;
begin
NameThreadForDebugging('MyThread');
while True do
begin
if (PrevLine1 <> CurLine1) and (PrevLine2 <> CurLine2) then
begin
{some code}
PrevLine1 := CurLine1; //<-- The place where execution starts...
PrevLine2 := CurLine2;
{some code}
end;
Sleep(500);
end;
self.Terminate;
self.Destroy;
end;
I could place breakpoints in this procedure, but stops at
PrevLine1 := CurLine1; //<-- The place where execution starts...
CurLine1 is a private member that can be changed using the property of the object. Everything works fine, but only once an erroneous behavior occurs.
Has anyone come across something similar or know what steps to take to fix this?
Thanks in advance!
source
share