diff options
-rw-r--r-- | src/libcamera/thread.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp index 5d46eeb8..6f86e4a9 100644 --- a/src/libcamera/thread.cpp +++ b/src/libcamera/thread.cpp @@ -464,6 +464,8 @@ void Thread::moveObject(Object *object) /* Move pending messages to the message queue of the new thread. */ if (object->pendingMessages_) { + unsigned int movedMessages = 0; + for (std::unique_ptr<Message> &msg : currentData->messages_.list_) { if (!msg) continue; @@ -471,6 +473,14 @@ void Thread::moveObject(Object *object) continue; targetData->messages_.list_.push_back(std::move(msg)); + movedMessages++; + } + + if (movedMessages) { + EventDispatcher *dispatcher = + targetData->dispatcher_.load(std::memory_order_acquire); + if (dispatcher) + dispatcher->interrupt(); } } |