TThread.OnTerminate ?

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

TThread.OnTerminate ?

fredvs
Hello.

Does it exist a equivalent of the Delphi TThread.OnTerminate ?
http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Classes_TThread_OnTerminate.html

I do not see it in fpc (or I miss something).

Thanks

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate ?

Michael Van Canneyt


On Sat, 18 Mar 2017, fredvs wrote:

> Hello.
>
> Does it exist a equivalent of the Delphi TThread.OnTerminate ?
> http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Classes_TThread_OnTerminate.html
>
> I do not see it in fpc (or I miss something).

You miss it. It exists and it is even documented:
http://www.freepascal.org/docs-html/current/rtl/classes/tthread.onterminate.html


Michael.
_______________________________________________
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 ?

fredvs
In reply to this post by fredvs
>  (or I miss something).

Yes, new glasses.

Sorry for the noise,

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate ?

fredvs
In reply to this post by Michael Van Canneyt
Oops, I did not see your answer.
Thanks Michael.

My original bug was that I did:

MyThread = class(TThread)
...
procedure OnTerminate ;
...

It was not working, of course because OnTerminate is a procedure of object:

procedure OnTerminate(sender: Tobject); ---> This solve all.

Fre;D
Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate ?

fredvs
> procedure OnTerminate(sender: Tobject); ---> This solve all.

Not sure. ;-(

Hello.

It is me again.

I am loosed.

If I do :

MyThread : = class(TThread);
...
procedure OnTerminate(sender: Tobject); override;
...

There is a error message:

Error: (3058) There is no method in an ancestor class to be overridden: "OnTerminate(TObject);"

;-(

Fre;D

Many thanks ;-)
Reply | Threaded
Open this post in threaded view
|

Re: TThread.OnTerminate ?

Bart-48
On 3/19/17, fredvs <[hidden email]> wrote:

> I am loosed.

lost is probably the word you're looking for ;-)


> procedure OnTerminate(sender: Tobject); override;
> ...

try
procedure DoTerminate; override;

Bart
_______________________________________________
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 ?

fredvs
Hello.

> procedure DoTerminate; override;

Yep, this is the working solution (finally i get it).

Many thanks Bart.

Fre;D
Many thanks ;-)