ring: always use a memory fence before incrementing the tail

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>
thorium: use rand_r() inside worker whenever possible

Signed-off-by: Sébastien Boisvert <boisvert@anl.gov>