diff --git a/src/core/ohos/SDL_ohos.c b/src/core/ohos/SDL_ohos.c index a9a71d10c8..a1bc83be95 100644 --- a/src/core/ohos/SDL_ohos.c +++ b/src/core/ohos/SDL_ohos.c @@ -130,6 +130,15 @@ void OHOS_removeWindow(SDL_Window* w) #endif } +void OHOS_LockPage() +{ + SDL_LockMutex(g_ohosPageMutex); +} +void OHOS_UnlockPage() +{ + SDL_UnlockMutex(g_ohosPageMutex); +} + static napi_value minus(napi_env env, napi_callback_info info) { size_t argc = 2; diff --git a/src/core/ohos/SDL_ohos.h b/src/core/ohos/SDL_ohos.h index 99d584d1a0..476d9a6fab 100644 --- a/src/core/ohos/SDL_ohos.h +++ b/src/core/ohos/SDL_ohos.h @@ -6,10 +6,10 @@ #include "video/SDL_sysvideo.h" #include -extern SDL_Mutex *g_ohosPageMutex; - void OHOS_windowDataFill(SDL_Window* w); void OHOS_removeWindow(SDL_Window* w); +void OHOS_LockPage(); +void OHOS_UnlockPage(); typedef struct SDL_VideoData { SDL_Rect textRect; diff --git a/src/video/ohos/SDL_ohosgl.c b/src/video/ohos/SDL_ohosgl.c index 7f8bd92158..7dde4cab2f 100644 --- a/src/video/ohos/SDL_ohosgl.c +++ b/src/video/ohos/SDL_ohosgl.c @@ -19,11 +19,11 @@ SDL_GLContext OHOS_GLES_CreateContext(SDL_VideoDevice *_this, SDL_Window *window { SDL_GLContext result; - SDL_LockMutex(g_ohosPageMutex); + OHOS_LockPage(); result = SDL_EGL_CreateContext(_this, window->internal->egl_surface); - SDL_UnlockMutex(g_ohosPageMutex); + OHOS_UnlockPage(); return result; } @@ -32,11 +32,11 @@ bool OHOS_GLES_SwapWindow(SDL_VideoDevice *_this, SDL_Window *window) { bool result; - SDL_LockMutex(g_ohosPageMutex); + OHOS_LockPage(); result = SDL_EGL_SwapBuffers(_this, window->internal->egl_surface); - SDL_UnlockMutex(g_ohosPageMutex); + OHOS_UnlockPage(); return result; }