From 1deb95b804fcc67f1f178703686134af548faa0f Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 27 Nov 2020 09:30:09 +1100 Subject: [PATCH] renderer: run tickets in the thread they're rendering in Fixes #1380 --- app/threading/threadpool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/threading/threadpool.cpp b/app/threading/threadpool.cpp index a77fbf72d..3f5cec6aa 100644 --- a/app/threading/threadpool.cpp +++ b/app/threading/threadpool.cpp @@ -76,6 +76,9 @@ void ThreadPool::RunNext() ThreadPoolThread* thread = available_threads_.front(); available_threads_.pop_front(); + // Move ticket to other thread so event processing can occur there + ticket->moveToThread(thread); + // Run the ticket in the thread, which actually just calls our virtual function RunTicket thread->RunTicket(ticket); } @@ -119,6 +122,10 @@ void ThreadPoolThread::run() if (ticket_) { pool_->RunTicket(ticket_); + + // Move back to calling thread (hacky?) + ticket_->moveToThread(this->thread()); + ticket_ = nullptr; }