On Fri, May 2, 2014 at 10:33 AM, Ian Romanick <i...@freedesktop.org> wrote: > On 04/22/2014 01:58 AM, Chia-I Wu wrote: >> There may be two contexts compiling shaders at the same time, and we want the >> anonymous struct id to be globally unique. > > I am not very excited about this. > > Is there any chance of getting stdatomic.h for the MSVC compilers that > people care about? I'd much rather have this code be... > > if (identifier == NULL) { > static volatile atomic_uint_t anon_count = ATOMIC_VAR_INIT(1); > unsigned count; > > count = atomic_fetch_add(&anon_count, 1); > identifier = ralloc_asprintf(this, "#anon_struct_%04x", count); > }
Note that gcc-4.9 is the first version to have stdatomic.h. gcc has supported atomic built-ins for a long time though: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev