[Lazarus] TThread in console mode program.

Donald Ziesig donald at ziesig.org
Thu Jul 21 21:05:17 CEST 2016


Hi All:

I am still trying to get timers to work in a console mode program.  
While I was doing that I ran into problems with TThread.


Question:  Do console mode programs have a "run loop"?.  The reason I am 
asking is that both Raspbian and Linux Mint TThread's Synchronize method 
apparently does nothing (it works fine when used with LCL).  I can call 
it, but it doesn't run the method passed as a parameter, nor does it return.


I wrote a trivial console mode program that uses TThread and tested it 
on both Raspbian and Linux Mint with exactly the same results.

The simplest Execute method fails:


procedure TXThread.Execute;

begin

   Synchronize( Callback );

end;

I have tried stepping into Synchronize, but even the debugger seems to 
get lost.


If I change Execute to:


procedure TXThread.Execute;

begin

   Callback;

end;

the Callback method is invoked (seemingly in the main thread, but I'm 
not sure... Will have to figure it out later).


Thanks,


Don Ziesig





More information about the Lazarus mailing list