nim-works / loony

A high throughput MPMC lock-free queue based on a paper by Giersch, Nolte et al implemented in pure Nim.
https://nim-works.github.io/loony/
MIT License
64 stars 4 forks source link

Applied memory safety thread fence and assoc documentation #13

Closed shayanhabibi closed 2 years ago

shayanhabibi commented 2 years ago

In regards to #9

Unfortunately tsan/asan/valgrind will continue to not agree with nim in general since deallocshared on thread destructions will consistently triggered global memory writes

shayanhabibi commented 2 years ago

See my comment here to show the tsan/asan analysis pre & post this PR

shayanhabibi commented 2 years ago

We need tests that actually do work and TRY to run into data races and undefined behaviour.

The deallocations and what not are more reasonable and are unlikely to actually cause undefined behaviour in our program despite thread sanitizers whinging about them.

shayanhabibi commented 2 years ago

Will have to fix that but I'm really struggling to think of how I can develop a stringent test for memory coherance that doesn't rely on thread sanitizers since they will raise problems either way.