TThread.OnTerminate never called

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

TThread.OnTerminate never called

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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate never called

Luca Olivetti-2
El 21/4/19 a les 18:22, Dennis ha escrit:
> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate never called

Free Pascal - General mailing list
In reply to this post by Dennis
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.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate never called

Dennis


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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate never called

Free Pascal - General mailing list
Dennis <[hidden email]> schrieb am Sa., 27. Apr. 2019, 05:22:


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 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal