once: Fix race causing pa_once to sometimes run twice
authorDavid Henningsson <david.henningsson@canonical.com>
Fri, 18 May 2012 20:29:41 +0000 (22:29 +0200)
committerArun Raghavan <arun.raghavan@collabora.co.uk>
Tue, 3 Jul 2012 11:48:24 +0000 (17:18 +0530)
commitac1a466f219389e543e2edd75dd5ea6cb86ef3f7
tree2622fbbddf0ccddbd6ddaf668e4b051e6458abfa
parent1c055d70b09fd63156cdc8a49989977031e0f4af
once: Fix race causing pa_once to sometimes run twice

There was a race in the existing code that could cause the pa_once code
to be run twice, see:
http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-April/013354.html

Therefore the existing implementation was rewritten to instead look like
the reference implementation here:
http://www.hpl.hp.com/research/linux/atomic_ops/example.php4

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/pulsecore/once.c
src/pulsecore/once.h