[Lazarus] Threads in Lazarus code base

Sven Barth pascaldragon at googlemail.com
Sun Sep 19 13:36:47 CEST 2010


On 19.09.2010 11:40, Graeme Geldenhuys wrote:
> On 19 September 2010 11:12, Sven Barth<pascaldragon at googlemail.com>  wrote:
>>> Well, one pain less. Delphi deprecated suspending/resuming of threads.
>>
>> Huh? O.o Did they give a reason for this move?
>
> Quoting from a Linux website (but applies to windows and other platforms too)
>
> "Notice that thr_suspend() is inherently dangerous and prone to race
> conditions. For one thing, there is no control on where the target
> thread  stops: it can very well be stopped in the middle of a critical
> section, while holding mutexes. Also, there is no guarantee on when
> the target thread  will actually stop. For these reasons, you'd be
> much better off using mutexes and conditions instead. The only
> situations that really require the ability to suspend a thread are
> debuggers and some kind of garbage collectors."
>
>
> For a more detailed explanation (see why Java doesn't support it either):
>
> http://download.oracle.com/javase/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html
>
>

Ok... that can be seen as a reason...

Regards,
Sven




More information about the Lazarus mailing list