Board index » kylix » TThread.Execute() ??

TThread.Execute() ??


2005-09-13 03:19:48 AM
kylix0
hi all
I have been having some strange problems using custom threads..
To make an understandable summary of the problem.. I have my custom TThread
and after a lot of debugging I noticed that it never call the Execute()
procedure unless I explicitly call it myself. I have tried creating the
thread suspended and then resume() or not suspended... I cannot understand
why the Execute() procedure does not automatically run. In windows (delphi
7) the same code works smoothly :-(
Alex
 
 

Re:TThread.Execute() ??

Wrong call.... the thread works fine.
What creates the thread to stuck is a ReadLn call from an Indy
TIdTCPConnection component within the execute() function that does not time
out.
 

Re:TThread.Execute() ??

Quote
I have been having some strange problems using custom threads..

To make an understandable summary of the problem.. I have my custom
TThread and after a lot of debugging I noticed that it never call the
Execute() procedure unless I explicitly call it myself. I have tried
creating the thread suspended and then resume() or not suspended... I
cannot understand why the Execute() procedure does not automatically run.
In windows (delphi 7) the same code works smoothly :-(
The problem now is completely resolved. I am posting the solution in case
some else can get help from this in the future.
The thread was asking an indy component to read TCP/IP data and was then
calling Synchronize(FMainProgram.HandleInput); to handle the data.
Apparently there is some bug with Synchronize() so I had to throw it away
and add a TCriticalSection inside then HandleInput procedure to ensure
synchronization.
something like
FLock.Enter;
try
...
finally
FLock.Leave;
end;
 

{smallsort}