don't call endFrame() unless beginFrame() was called

only use condition_variable on non-emscripten builds
This commit is contained in:
Nick Fisher
2025-06-03 16:39:04 +08:00
parent 28aef7e5cc
commit e147e59d8d
6 changed files with 41 additions and 28 deletions

View File

@@ -32,7 +32,7 @@ static void Log(const char *fmt, ...) {
#endif
va_end(args);
}
#endif
#endif // ifdef __EMSCRIPTEN__
#if defined(_WIN32) || defined(_WIN64)
#define __FILENAME__ (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)

View File

@@ -75,10 +75,8 @@ public:
#endif
bool mRendered = false;
private:
bool mRender = false;
private:
std::mutex _taskMutex;
std::condition_variable _cv;
std::deque<std::function<void()>> _tasks;
@@ -106,8 +104,9 @@ auto RenderThread::add_task(std::packaged_task<Rt()>& pt) -> std::future<Rt> {
_tasks.push_back([pt = std::make_shared<std::packaged_task<Rt()>>(
std::move(pt))]
{ (*pt)(); });
#ifndef __EMSCRIPTEN__
_cv.notify_one();
#endif
return ret;