Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-04

TThread.OnTerminate never called

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

I am using FPC 3.0.4 Lazarus 2.00 on windows 64

I created a subclass of TThread and found out that the TThread.OnTerminate event was never called (I already assigned it). Also, I search the source code of TThread in classeh.inc and found that there was no calling of FOnTerminate nor OnTerminate

Is it supposed to be a dummy place holder?
I don't use Delphi any more. Is this behaviour the same as Delphi?

Thanks in advance.

Dennis

Reply by email

Luca Olivetti
to Dennis

El 21/4/19 a les 18:22, Dennis ha escrit:

Show quoted text 6 lines
I am using FPC 3.0.4 Lazarus 2.00 on windows 64 I created a subclass of TThread and found out that the TThread.OnTerminate event was never called (I already assigned it). Also, I search the source code of TThread in classeh.inc and found that there was no calling of FOnTerminate nor OnTerminate

function ThreadProc in objpas/classes/classes.inc calls Thread.DoTerminate, which in turn checks for FOnTerminate and calls it.

Bye

Luca

Reply by email

Sven Barth
to Dennis: I am using FPC 3.0.4 Lazarus 2.00 on windows 64 I created a subclass of TThread and found…
Dennis wrote 11 lines
I am using FPC 3.0.4 Lazarus 2.00 on windows 64 I created a subclass of TThread and found out that the TThread.OnTerminate event was never called (I already assigned it). Also, I search the source code of TThread in classeh.inc and found that there was no calling of FOnTerminate nor OnTerminate Is it supposed to be a dummy place holder? I don't use Delphi any more. Is this behaviour the same as Delphi? Thanks in advance.

How did you test it? OnTerminate is called using Synchronize so if you use a command line program to test it you need to make sure to call CheckSynchronize otherwise you'll never see it being called. In a LCL program that should work without any further action.

Regards,
Sven

Reply by email

Dennis
to Sven Barth
Sven Barth wrote 18 lines
Am 21.04.2019 um 18:22 schrieb Dennis: > I am using FPC 3.0.4 Lazarus 2.00 on windows 64 > > I created a subclass of TThread and found out that the > TThread.OnTerminate event was never called (I already assigned it). > Also, I search the source code of TThread in classeh.inc and found > that there was no calling of FOnTerminate nor OnTerminate > > Is it supposed to be a dummy place holder? > I don't use Delphi any more. Is this behaviour the same as Delphi? > > Thanks in advance. How did you test it? OnTerminate is called using Synchronize so if you use a command line program to test it you need to make sure to call CheckSynchronize otherwise you'll never see it being called. In a LCL program that should work without any further action.

I am using the debugger to break on the Event assigned to OnTerminate.  That breakpoint was never reached.
I am using the FpDebug internal Dwart-debugger (beta) Can you tell me what the code of calling synchronize(OnTerminate) is?  I cannot find it in the FPC source.
Dennis

Reply by email

Sven Barth
to Dennis

Dennis schrieb am Sa., 27. Apr. 2019, 05:22:

Show quoted text 28 lines
Sven Barth via fpc-pascal wrote: > Am 21.04.2019 um 18:22 schrieb Dennis: >> I am using FPC 3.0.4 Lazarus 2.00 on windows 64 >> >> I created a subclass of TThread and found out that the >> TThread.OnTerminate event was never called (I already assigned it). >> Also, I search the source code of TThread in classeh.inc and found >> that there was no calling of FOnTerminate nor OnTerminate >> >> Is it supposed to be a dummy place holder? >> I don't use Delphi any more. Is this behaviour the same as Delphi? >> >> Thanks in advance. > > How did you test it? OnTerminate is called using Synchronize so if you > use a command line program to test it you need to make sure to call > CheckSynchronize otherwise you'll never see it being called. In a LCL > program that should work without any further action. > I am using the debugger to break on the Event assigned to OnTerminate. That breakpoint was never reached. I am using the FpDebug internal Dwart-debugger (beta) Can you tell me what the code of calling synchronize(OnTerminate) is? I cannot find it in the FPC source. Dennis

I'm not asking whether you used a debugger, I'm asking whether you used a command line program or a GUI program to test it.

Regards,
Sven

Reply by email