[Mesa-dev] RFC: C11 threads.h
brianp at vmware.com
Fri Mar 15 06:58:39 PDT 2013
On 03/14/2013 05:10 PM, Jose Fonseca wrote:
> 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
> 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.
This looks OK to me.
Could we eventually go a step further and replace _EGLMutex,
pipe_mutex, u_mutex, etc. with mtx_t (and similar with thrd_t, cnd_t,
More information about the mesa-dev