diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-01-21 04:40:59 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-01-25 02:39:10 +0200 |
commit | 652b47249a63f3cf9abb8fc2c51d6a16dedab81a (patch) | |
tree | 0c0f43ec113b6729cf649cab59a1f02b17a825f2 | |
parent | 1f5d485bfb1728dc6e2e57a6714709c2aad4e4a7 (diff) |
test: message: Remove incorrect slow receiver test
The slow receiver test verifies there's no race condition between
concurrent message delivery and object deletion. This is not a valid use
case in the first place, as objects are not allowed to be deleted from a
different thread than the one they are bound to. Remove the incorrect
test.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
-rw-r--r-- | test/message.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/test/message.cpp b/test/message.cpp index 0e76f323..a34e0f0b 100644 --- a/test/message.cpp +++ b/test/message.cpp @@ -93,25 +93,6 @@ private: bool success_; }; -class SlowMessageReceiver : public Object -{ -protected: - void message(Message *msg) - { - if (msg->type() != Message::None) { - Object::message(msg); - return; - } - - /* - * Don't access any member of the object here (including the - * vtable) as the object will be deleted by the main thread - * while we're sleeping. - */ - this_thread::sleep_for(chrono::milliseconds(100)); - } -}; - class MessageTest : public Test { protected: @@ -149,21 +130,6 @@ protected: } /* - * Test for races between message delivery and object deletion. - * Failures result in assertion errors, there is no need for - * explicit checks. - */ - SlowMessageReceiver *slowReceiver = new SlowMessageReceiver(); - slowReceiver->moveToThread(&thread_); - slowReceiver->postMessage(std::make_unique<Message>(Message::None)); - - this_thread::sleep_for(chrono::milliseconds(10)); - - delete slowReceiver; - - this_thread::sleep_for(chrono::milliseconds(100)); - - /* * Test recursive calls to Thread::dispatchMessages(). Messages * should be delivered correctly, without crashes or memory * leaks. Two messages need to be posted to ensure we don't only |