SOURCES = \
src/coregl.c \
- src/coregl_thread_pthread.c \
+ src/coregl_thread_pthread_and_gcc_tlv.c \
src/coregl_trace.c \
src/coregl_export.c \
src/coregl_export_egl.c \
--- /dev/null
+#include "coregl_internal.h"
+
+//////////////////////////////////////////////////////////////////////////
+// Need implement this
+int mutex_lock(Mutex *mt);
+int mutex_unlock(Mutex *mt);
+int get_current_thread();
+int set_current_thread_state(GLThreadState *tstate);
+GLThreadState * get_current_thread_state();
+//////////////////////////////////////////////////////////////////////////
+
+static __thread GLThreadState *per_thread_state = NULL;
+
+int
+mutex_lock(Mutex *mt)
+{
+ int ret = 0;
+
+ if (pthread_mutex_lock(mt) == 0)
+ ret = 1;
+ else
+ ret = 0;
+
+ return ret;
+}
+
+int
+mutex_unlock(Mutex *mt)
+{
+ int ret = 0;
+
+ if (pthread_mutex_unlock(mt) == 0)
+ ret = 1;
+ else
+ ret = 0;
+
+ return ret;
+}
+
+int
+get_current_thread()
+{
+ return pthread_self();
+}
+
+int
+set_current_thread_state(GLThreadState *tstate)
+{
+ per_thread_state = tstate;
+ return 1;
+}
+
+GLThreadState *
+get_current_thread_state()
+{
+ return per_thread_state;
+}
+
+
int err = _orig_fastpath_glGetError(); \
if (err != GL_NO_ERROR) \
{ \
- printf("\E[0;31;1mERROR(GL %p) : %s returns GL error 0x%X\E[0m\n", oldctx->cstate, #func, err); \
+ ERR("\E[0;31;1mERROR(GL %p) : %s returns GL error 0x%X\E[0m\n", oldctx->cstate, #func, err); \
goto finish; \
} \
}