On Tue, 12 Oct 2010, Michael Schnell wrote:

On 10/12/2010 11:43 AM, Michael Van Canneyt wrote:



There must be another call as well, I assume Synchronize(), in the thread
that you are waiting on.

Why should Synchronize deadlock a Waitfor ? I understand that in Waitfor other main thread events (e.g. Gui generated ones) should run.

There is not a single line of documentation that justifies this expectation.

Synchronize stalls the thread until the appropriate main thread event handler (given as a parameter with Sychronize) has been run. If MainThread Events do run in WaitFor there is no need for an (additional) chance for a deadlock.

Events bypass normal threading mechanisms, in particular synchronize(). You get away with it on Windows because of this.

Now, before you discuss: I understand that the 'expected behaviour' is
desirable, but I just want to argue that your expectations are not backed up by the API documentation, and that, therefor, you are responsible for
creating deadlock.

See also my reply to Graeme.

Michael.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to