On 07/02/2021 14:45, Jonas Maebe via fpc-devel wrote:
On 02/02/2021 16:48, C Western via fpc-devel wrote:
My application works fine single threaded, but crashes occasionally when
multi threaded, with what I think is some sort of memory corruption, but
I haven't been able to pin this down yet, and fixing the above two
points would help.
It's probably a data race. AArch64's memory model is much more relaxed
than that of x86-64, so data races are much more likely to lead to
errors. Additionally, while on x86 interlocked* routines implicitly act
as memory barriers between them (due to an architectural idiosyncrasy),
they don't on any other architecture.

I have located a possible fix; however I don't understand why I need to make the change I did. The variable reads/writes of concern currently use SetEvent in one thread and WaitFor in another - do theseĀ  not have implicitĀ  memory barriers in them? Or is an explicit memory barrier required in AArch64? (or it could also be a different issue).

Colin

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to