Mesa (master): mapi: use c11 call_once() instead of pthread_once()

Brian Paul brianp at kemper.freedesktop.org
Thu Mar 5 14:19:32 UTC 2015


Module: Mesa
Branch: master
Commit: 262cd683e22ec64645a50b558f91001b75ea2000
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=262cd683e22ec64645a50b558f91001b75ea2000

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Mar  4 19:17:57 2015 -0700

mapi: use c11 call_once() instead of pthread_once()

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/mapi/glapi/glapi_entrypoint.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mapi/glapi/glapi_entrypoint.c b/src/mapi/glapi/glapi_entrypoint.c
index 53104ce..7facd8a 100644
--- a/src/mapi/glapi/glapi_entrypoint.c
+++ b/src/mapi/glapi/glapi_entrypoint.c
@@ -29,6 +29,7 @@
  */
 
 
+#include "c11/threads.h"
 #include "glapi/glapi_priv.h"
 #include "u_execmem.h"
 
@@ -336,7 +337,7 @@ void
 init_glapi_relocs_once( void )
 {
 #if defined(HAVE_PTHREAD) || defined(GLX_USE_TLS)
-   static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-   pthread_once( & once_control, init_glapi_relocs );
+   static once_flag flag = ONCE_FLAG_INIT;
+   call_once(&flag, init_glapi_relocs);
 #endif
 }




More information about the mesa-commit mailing list