mesa: Add missing include guards
[mesa.git] / src / mesa / main / execmem.c
index d63bb4a4e56d5a15f1111fc3014e0437f04e5389..2142b50a6e93e5a7c6a516a28a5fcec3aaea1840 100644 (file)
  */
 
 
+#include <stdio.h>
 #include "imports.h"
-#include "glapi/glthread.h"
-
+#include "execmem.h"
+#include "c11/threads.h"
 
 
 #if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__)
@@ -59,7 +60,7 @@
 
 #define EXEC_HEAP_SIZE (10*1024*1024)
 
-_glthread_DECLARE_STATIC_MUTEX(exec_mutex);
+static mtx_t exec_mutex = _MTX_INITIALIZER_NP;
 
 static struct mem_block *exec_heap = NULL;
 static unsigned char *exec_mem = NULL;
@@ -93,7 +94,7 @@ _mesa_exec_malloc(GLuint size)
    struct mem_block *block = NULL;
    void *addr = NULL;
 
-   _glthread_LOCK_MUTEX(exec_mutex);
+   mtx_lock(&exec_mutex);
 
    if (!init_heap())
       goto bail;
@@ -109,7 +110,7 @@ _mesa_exec_malloc(GLuint size)
       printf("_mesa_exec_malloc failed\n");
 
 bail:
-   _glthread_UNLOCK_MUTEX(exec_mutex);
+   mtx_unlock(&exec_mutex);
    
    return addr;
 }
@@ -118,7 +119,7 @@ bail:
 void 
 _mesa_exec_free(void *addr)
 {
-   _glthread_LOCK_MUTEX(exec_mutex);
+   mtx_lock(&exec_mutex);
 
    if (exec_heap) {
       struct mem_block *block = mmFindBlock(exec_heap, (unsigned char *)addr - exec_mem);
@@ -127,7 +128,7 @@ _mesa_exec_free(void *addr)
         mmFreeMem(block);
    }
 
-   _glthread_UNLOCK_MUTEX(exec_mutex);
+   mtx_unlock(&exec_mutex);
 }