[fpc-devel] TThread.Terminate;

Sven Barth pascaldragon at googlemail.com
Sat Aug 22 23:16:34 CEST 2020


Am 22.08.2020 um 18:45 schrieb Jonas Maebe via fpc-devel:
> On 22/08/2020 17:39, Martin Frb via fpc-devel wrote:
>> I guess the "Terminate" field is actually about cache coherency.
> Yes, but as mentioned earlier it's in general completely useless to
> force the overhead of cache coherency for it. By design it's not
> something that will be checked immediately after it gets set, so who
> cares if the target thread doesn't see its new value immediately?
>
> If you do care, then you need some other way to signal the target thread
> to immediately drop what it's doing, but then there is no point in
> checking the Terminated property anymore since that signal will already
> have performed the same function.
The new, virtual TerminatedSet method can be used for such a signal. 
It's called after FTerminated was set to True an can be used for example 
to trigger an event the thread might be waiting on.

Regards,
Sven


More information about the fpc-devel mailing list