[fpc-pascal] TThread.Queue vs TThread.Synchronize
Philippe at quarta.com.br
Mon Feb 23 20:59:19 CET 2015
perfect! that's what I was understanding ...
De: fpc-pascal-bounces at lists.freepascal.org <fpc-pascal-bounces at lists.freepascal.org> em nome de Sven Barth <pascaldragon at googlemail.com>
Enviado: segunda-feira, 23 de fevereiro de 2015 16:55
Para: fpc-pascal at lists.freepascal.org
Assunto: Re: [fpc-pascal] TThread.Queue vs TThread.Synchronize
On 23.02.2015 20:49, Philippe Lévi wrote:
> sorry ... I still not understand the "idea".
> if code in thread access a local variable (in stack) of the function
> where thread is issued ... it may access "something" which does not
> exist any more. correct?
It's not about the thread, but about the scope. As long as you pass a
nested procedure around and that is only stored/used as long as the
procedure in which the nested procedure is declared is in scope as well
everything is fine. But once the surrounding procedure exits the
procedure variable is no basically no longer valid, because the stack
frame of the outer procedure no longer exists.
Only anonymous functions/closures will change that.
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
More information about the fpc-pascal