fix recurseve mutex on Android

This commit is contained in:
2018-12-15 16:35:37 +01:00
parent 188e2336cc
commit 9d13087036
2 changed files with 7 additions and 2 deletions

View File

@@ -16,6 +16,7 @@
*/
//BEGIN_INCLUDE(all)
#include <mutex>
#include <initializer_list>
#include <memory>
#include <jni.h>
@@ -51,6 +52,7 @@ typedef void (*fnDebugMessageCallback)(GLDEBUGPROC callback, const void* userPar
EGLDisplay g_display = EGL_NO_DISPLAY;
EGLContext g_context = EGL_NO_CONTEXT;
std::recursive_mutex mutex;
jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/)
{
@@ -124,7 +126,7 @@ int GetUnicodeChar(struct android_app* app, int eventType, int keyCode, int meta
void android_async_lock(struct engine* engine)
{
pthread_mutex_lock(&engine->app->mutex);
mutex.lock();
eglMakeCurrent(engine->display, engine->surface, engine->surface, engine->context);
}
@@ -136,7 +138,7 @@ void android_async_swap(struct engine* engine)
void android_async_unlock(struct engine* engine)
{
eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
pthread_mutex_unlock(&engine->app->mutex);
mutex.unlock();
}
struct locker