⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 264017 in webkit


Ignore:
Timestamp:
Jul 7, 2020, 8:07:52 AM (6 years ago)
Author:
ggaren@apple.com
Message:

Added a test for callOnMainThread
https://bugs.webkit.org/show_bug.cgi?id=214025

Reviewed by Sam Weinig.

This test failed prior to https://trac.webkit.org/changeset/263981.

  • TestWebKitAPI/Tests/WTF/RunLoop.cpp:

(TestWebKitAPI::TEST): Added a test demonstrating why a simple "is the
queue empty?" check doesn't work when you support both re-entrancy and
threads. While the main thread is sleeping in a nested RunLoop, a
secondary thread can see a non-empty queue.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r264013 r264017  
     12020-07-07  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added a test for callOnMainThread
     4        https://bugs.webkit.org/show_bug.cgi?id=214025
     5
     6        Reviewed by Sam Weinig.
     7
     8        This test failed prior to https://trac.webkit.org/changeset/263981.
     9
     10        * TestWebKitAPI/Tests/WTF/RunLoop.cpp:
     11        (TestWebKitAPI::TEST): Added a test demonstrating why a simple "is the
     12        queue empty?" check doesn't work when you support both re-entrancy and
     13        threads. While the main thread is sleeping in a nested RunLoop, a
     14        secondary thread can see a non-empty queue.
     15
    1162020-07-07  Philippe Normand  <pnormand@igalia.com>
    217
  • trunk/Tools/TestWebKitAPI/Tests/WTF/RunLoop.cpp

    r263973 r264017  
    9898}
    9999
     100TEST(WTF_RunLoop, CallOnMainCrossThreadWhileNested)
     101{
     102    WTF::initializeMainThread();
     103
     104    bool done = false;
     105
     106    callOnMainThread([&done] {
     107        Thread::create("CallOnMainCrossThread", [&done] {
     108            callOnMainThread([&done] {
     109                done = true;
     110            });
     111        });
     112
     113        Util::run(&done);
     114    });
     115    callOnMainThread([] { });
     116
     117    Util::run(&done);
     118}
     119
    100120class DerivedOneShotTimer : public RunLoop::Timer<DerivedOneShotTimer> {
    101121public:
Note: See TracChangeset for help on using the changeset viewer.