diff --git a/examples/common/entry/entry_android.cpp b/examples/common/entry/entry_android.cpp index cbcdb563b..3c39f6085 100644 --- a/examples/common/entry/entry_android.cpp +++ b/examples/common/entry/entry_android.cpp @@ -88,7 +88,7 @@ namespace entry int m_argc; const char* const* m_argv; - static int32_t threadFunc(void* _userData); + static int32_t threadFunc(bx::Thread* _thread, void* _userData); }; class FileReaderAndroid : public bx::FileReaderI @@ -550,8 +550,10 @@ namespace entry BX_UNUSED(_handle, _lock); } - int32_t MainThreadEntry::threadFunc(void* _userData) + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { + BX_UNUSED(_thread); + int32_t result = chdir("/sdcard/bgfx/examples/runtime"); BX_CHECK(0 == result, "Failed to chdir to dir. android.permission.WRITE_EXTERNAL_STORAGE?", errno); diff --git a/examples/common/entry/entry_glfw.cpp b/examples/common/entry/entry_glfw.cpp index 312494350..9453bcd23 100644 --- a/examples/common/entry/entry_glfw.cpp +++ b/examples/common/entry/entry_glfw.cpp @@ -230,7 +230,7 @@ namespace entry int m_argc; const char* const* m_argv; - static int32_t threadFunc(void* _userData); + static int32_t threadFunc(bx::Thread* _thread, void* _userData); }; enum MsgType @@ -837,8 +837,10 @@ namespace entry glfwPostEmptyEvent(); } - int32_t MainThreadEntry::threadFunc(void* _userData) + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { + BX_UNUSED(_thread); + MainThreadEntry* self = (MainThreadEntry*)_userData; int32_t result = main(self->m_argc, self->m_argv); diff --git a/examples/common/entry/entry_ios.mm b/examples/common/entry/entry_ios.mm index 1b32ba425..d781089fb 100644 --- a/examples/common/entry/entry_ios.mm +++ b/examples/common/entry/entry_ios.mm @@ -29,7 +29,7 @@ namespace entry int m_argc; const char* const* m_argv; - static int32_t threadFunc(void* _userData); + static int32_t threadFunc(bx::Thread* _thread, void* _userData); }; static WindowHandle s_defaultWindow = { 0 }; @@ -63,19 +63,22 @@ namespace entry static Context* s_ctx; - int32_t MainThreadEntry::threadFunc(void* _userData) + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { + BX_UNUSED(_thread); + CFBundleRef mainBundle = CFBundleGetMainBundle(); - if ( mainBundle != nil ) + if (mainBundle != nil) { CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); - if ( resourcesURL != nil ) + if (resourcesURL != nil) { char path[PATH_MAX]; - if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) ) + if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8*)path, PATH_MAX) ) { chdir(path); } + CFRelease(resourcesURL); } } diff --git a/examples/common/entry/entry_osx.mm b/examples/common/entry/entry_osx.mm index 12be9ec9d..a31e711e0 100644 --- a/examples/common/entry/entry_osx.mm +++ b/examples/common/entry/entry_osx.mm @@ -66,19 +66,22 @@ namespace entry int m_argc; const char* const* m_argv; - static int32_t threadFunc(void* _userData) + static int32_t threadFunc(bx::Thread* _thread, void* _userData); { + BX_UNUSED(_thread); + CFBundleRef mainBundle = CFBundleGetMainBundle(); - if ( mainBundle != nil ) + if (mainBundle != nil) { CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); - if ( resourcesURL != nil ) + if (resourcesURL != nil) { char path[PATH_MAX]; - if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX) ) + if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8*)path, PATH_MAX) ) { chdir(path); } + CFRelease(resourcesURL); } } diff --git a/examples/common/entry/entry_sdl.cpp b/examples/common/entry/entry_sdl.cpp index e8c82d387..62a59b5bc 100644 --- a/examples/common/entry/entry_sdl.cpp +++ b/examples/common/entry/entry_sdl.cpp @@ -249,7 +249,7 @@ namespace entry int m_argc; char** m_argv; - static int32_t threadFunc(void* _userData); + static int32_t threadFunc(bx::Thread* _thread, void* _userData); }; /// @@ -1090,8 +1090,10 @@ namespace entry sdlPostEvent(SDL_USER_WINDOW_MOUSE_LOCK, _handle, NULL, _lock); } - int32_t MainThreadEntry::threadFunc(void* _userData) + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { + BX_UNUSED(_thread); + MainThreadEntry* self = (MainThreadEntry*)_userData; int32_t result = main(self->m_argc, self->m_argv); diff --git a/examples/common/entry/entry_x11.cpp b/examples/common/entry/entry_x11.cpp index f55ee4baf..d65520f4f 100644 --- a/examples/common/entry/entry_x11.cpp +++ b/examples/common/entry/entry_x11.cpp @@ -223,7 +223,7 @@ namespace entry int32_t m_argc; const char* const* m_argv; - static int32_t threadFunc(void* _userData); + static int32_t threadFunc(bx::Thread* _thread, void* _userData); }; struct Msg @@ -679,8 +679,10 @@ namespace entry static Context s_ctx; - int32_t MainThreadEntry::threadFunc(void* _userData) + int32_t MainThreadEntry::threadFunc(bx::Thread* _thread, void* _userData) { + BX_UNUSED(_thread); + MainThreadEntry* self = (MainThreadEntry*)_userData; int32_t result = main(self->m_argc, self->m_argv); s_ctx.m_exit = true;