[Lazarus] PostMessage return value

Sven Barth pascaldragon at googlemail.com
Tue Sep 16 07:46:43 CEST 2014


On 16.09.2014 00:06, Xiangrong Fang wrote:
> 2014-09-15 22:30 GMT+08:00 Michael Schnell <mschnell at lumino.de
> <mailto:mschnell at lumino.de>>:
>
>>     Is that ok? To be exact, when a thread's execute() finished, it
>>     will go to a "sleep" status,
>     No. It will die.
>>     and can be reused by calling execute() again, right?
>     AFAIK: No.
>
>
> What's the meaning of "die"? By "calling execute()" I simply mean call
> its Start() method. I will create the thread in "Suspended" mode, i.e.
> Create(True).  So I hope I can Start() it again after Execute() ended.
>
> That's what I understand where the document said Resume() is deprecated
> and replaced by Start(), which means, Start() can be called multiple times??

No. A thread's Execute() method is only called once. If it exits the 
thread ends to never return.
Suspend() uses operating system functionality to stop a thread's 
execution whereever it currently is (dangerous!) and Resume() let's the 
thread continue its execution from that point on. Now with the 
deprecation of these two methods a new method was needed to get the 
thread out of the "create suspended" state. Thus Start() was born 
(internally Start() is basically just an alias for Resume()). It's only 
reason of existance is to start a thread that was created as suspended.

Regards,
Sven




More information about the Lazarus mailing list