Hm, is #valgrind's #helgrind useless for code using #atomic operations? Example, it complains about this:
==9505== Possible data race during read of size 4 at 0xADD57F4 by thread #14
==9505== Locks held: none
==9505== at 0x23D0F1: PSC_ThreadPool_cancel (threadpool.c:761)
[....]
==9505== This conflicts with a previous write of size 4 by thread #6
==9505== Locks held: none
==9505== at 0x23CDDE: worker (threadpool.c:373)
so, here's threadpool.c:761:
if ((pthrno = atomic_load_explicit(
&job->pthrno, memory_order_consume)) >= 0)
and here's threadpool.c:373:
atomic_store_explicit(¤tJob->pthrno, -1,
memory_order_release);
Ok, I *think* this should be fine? Do I miss something?
(screenshots for readability ...)