glx: Fix build and warnings with -Dglx=dri -Dglx-direct=false
[mesa.git] / src / mapi / u_execmem.c
index b6751edb5dd51c33e6d3c101a0f8781804e5cbc6..d6e64c08886cda07fcd31ddd2da8308a3ca7f2c0 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
  *
  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  */
 
 
-#include "u_compiler.h"
-#include "u_thread.h"
+#include "c99_compat.h"
+#include "c11/threads.h"
 #include "u_execmem.h"
 
 
 #define EXEC_MAP_SIZE (4*1024)
 
-u_mutex_declare_static(exec_mutex);
+static mtx_t exec_mutex = _MTX_INITIALIZER_NP;
 
 static unsigned int head = 0;
 
 static unsigned char *exec_mem = (unsigned char *)0;
 
 
-#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__)
+#if defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__sun) || defined(__HAIKU__)
 
 #include <unistd.h>
 #include <sys/mman.h>
@@ -124,7 +123,7 @@ u_execmem_alloc(unsigned int size)
 {
    void *addr = NULL;
 
-   u_mutex_lock(exec_mutex);
+   mtx_lock(&exec_mutex);
 
    if (!init_map())
       goto bail;
@@ -138,7 +137,7 @@ u_execmem_alloc(unsigned int size)
    head += size;
 
 bail:
-   u_mutex_unlock(exec_mutex);
+   mtx_unlock(&exec_mutex);
 
    return addr;
 }