On 22/08/2020 16:09, Martin via fpc-devel wrote: > procedure TThread.Terminate; > begin > FTerminated := True; > end; > > Should that not in some way deal with memory barriers? E.g. > InterlockedExchange or similar?
Very important: InterlockedExchange is not a memory barrier, except on x86. > And the same for the "Terminated" property, should that have a getter to > do the same? > > As it stands, afaik a thread could get the "Terminate" flag with an > unknown delay? It's not a semaphore/signal, it's just a field. It will never be instantaneous since it can only have an effect once the target thread actually tries to read it. Wrapping it in a bunch of synchronisation primitives will make the whole system slower with no real benefit. Jonas _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel