On 16 Oct 2010, at 13:57, Benedikt Schindler wrote:
>>> - FreeOnTerminate should be gone, (meaning no way to actively call
>>> TThread.Destroy from another thread, a thread gets destroyed
>>> automatically when it leaves its execute method)
>>> (IIRC FreeOnTerminate was even set to False by the default
>>> constructor, so you had the choice of either using the default
>>> or introducing a race condition by setting it after the
>>> "inherited Create" - which starts the execute.)
>>
>> This problem has been solved with
>> http://bugs.freepascal.org/view.php?id=16884
>
> But i think also the "bug" report you are linking to, shouldn't be a fpc
> bug. It is more a programmer bug. As programmer i have to know at which
> time i call the create methode of my TThread.
He cannot. If freeonterminate=true, then even if you call "inherited
create(false)" as the very last statement of your constructor, the thread may
already have finished running and freed itself before AfterConstruction is
called. The AfterConstruction call will then crash.
Jonas
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal