mesa: include stdio.h where needed
[mesa.git] / src / mesa / main / execmem.c
index bb9c70a40084575f05c3ae2c076f91e3efd7f59b..3a1338515fe8d23f15429f7121042ab68ee1bda1 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
  *
  * Copyright (C) 1999-2005  Brian Paul   All Rights Reserved.
  *
  */
 
 
+#include <stdio.h>
 #include "imports.h"
-#include "glapi/glthread.h"
 
 
 
-#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun)
+#if defined(__linux__) || defined(__OpenBSD__) || defined(_NetBSD__) || defined(__sun) || defined(__HAIKU__)
 
 /*
  * Allocate a large block of memory which can hold code then dole it out
@@ -60,7 +59,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;
@@ -94,7 +93,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;
@@ -110,7 +109,7 @@ _mesa_exec_malloc(GLuint size)
       printf("_mesa_exec_malloc failed\n");
 
 bail:
-   _glthread_UNLOCK_MUTEX(exec_mutex);
+   mtx_unlock(&exec_mutex);
    
    return addr;
 }
@@ -119,7 +118,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);
@@ -128,7 +127,7 @@ _mesa_exec_free(void *addr)
         mmFreeMem(block);
    }
 
-   _glthread_UNLOCK_MUTEX(exec_mutex);
+   mtx_unlock(&exec_mutex);
 }