[Mesa-dev] RFC: C11 threads.h

Jose Fonseca jfonseca at vmware.com
Thu Mar 14 16:10:16 PDT 2013


Mesa source tree currently has 4 abstraction of threading primitives (in gallium, glapi, mapi, and egl components).

I'd like to unify all them, and since now the C11 standard introduced a threads.h header, I'd like to use that as model.

So for I've imported a C11 threads.h implementation from https://gist.github.com/yohhoy/2223710 , and reimplemented all

  http://cgit.freedesktop.org/~jrfonseca/mesa/log/?h=c11-threads

If there are no objections, the next step would be to eliminate all threading abstractions and just use C11 threads.h primitives.

The only snafu is the wide spread use of static mutex initializers. It's not supported by C11 threads -- I believe one needs to do the initialization via once_init paradigm instead. But for now I just side stepped the problem by defining a non standard initializer. I'll revisit this later.

A nice side-benefit of this is that the pre-vista Win32 conditional var implement should be much better than what we have now, which should speed up multithreaded llvmpipe on windows substantially.

The same principle could be applied to atomic operations.

Jose


More information about the mesa-dev mailing list