fix checkbox icon update, add unique check on async tasks
This commit is contained in:
31
src/app.cpp
31
src/app.cpp
@@ -27,14 +27,14 @@ void destroy_window();
|
||||
|
||||
App* App::I = nullptr; // singleton
|
||||
|
||||
std::deque<std::packaged_task<void()>> App::render_tasklist;
|
||||
std::deque<AppTask> App::render_tasklist;
|
||||
std::mutex App::render_task_mutex;
|
||||
std::condition_variable App::render_cv;
|
||||
std::thread App::render_thread;
|
||||
std::thread::id App::render_thread_id;
|
||||
bool App::render_running = false;
|
||||
|
||||
std::deque<std::packaged_task<void()>> App::ui_tasklist;
|
||||
std::deque<AppTask> App::ui_tasklist;
|
||||
std::mutex App::ui_task_mutex;
|
||||
std::condition_variable App::ui_cv;
|
||||
std::thread App::ui_thread;
|
||||
@@ -425,28 +425,6 @@ void App::async_start()
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::async_update()
|
||||
{
|
||||
#if __IOS__
|
||||
[ios_view->glview bindDrawable];
|
||||
#elif _WIN32
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
#endif
|
||||
redraw = true;
|
||||
clear();
|
||||
update(0);
|
||||
#if __OSX__
|
||||
[osx_view async_swap];
|
||||
#elif __IOS__
|
||||
[ios_view->glview bindDrawable];
|
||||
[ios_view async_swap];
|
||||
#elif __ANDROID__
|
||||
android_async_swap(and_engine);
|
||||
#elif _WIN32
|
||||
async_swap();
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::async_redraw()
|
||||
{
|
||||
redraw = true;
|
||||
@@ -822,7 +800,7 @@ void App::render_thread_main()
|
||||
render_running = true;
|
||||
while (render_running)
|
||||
{
|
||||
std::deque<std::packaged_task<void()>> working_list;
|
||||
std::deque<AppTask> working_list;
|
||||
|
||||
// move the task list locally to free the queue for other threads
|
||||
{
|
||||
@@ -838,6 +816,7 @@ void App::render_thread_main()
|
||||
while (!working_list.empty())
|
||||
{
|
||||
//LOG("render task %d", count);
|
||||
//LOG("task %s", working_list.front().name.c_str());
|
||||
count++;
|
||||
working_list.front()();
|
||||
working_list.pop_front();
|
||||
@@ -867,7 +846,7 @@ void App::ui_thread_main()
|
||||
int rendered_frames = 0;
|
||||
while (ui_running)
|
||||
{
|
||||
std::deque<std::packaged_task<void()>> working_list;
|
||||
std::deque<AppTask> working_list;
|
||||
|
||||
// move the task list locally to free the queue for other threads
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user