Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e22ee99e18e2119cb158fcd6323250b7a5eff84d
      
https://github.com/WebKit/WebKit/commit/e22ee99e18e2119cb158fcd6323250b7a5eff84d
  Author: Sihui Liu <[email protected]>
  Date:   2024-06-21 (Fri, 21 Jun 2024)

  Changed paths:
    M Source/WTF/wtf/SuspendableWorkQueue.cpp

  Log Message:
  -----------
  SuspendableWorkQueue might wait indefinitely
https://bugs.webkit.org/show_bug.cgi?id=275751
rdar://130203868

Reviewed by Chris Dumez.

Currently SuspendableWorkQueue::resume() only notifies when state is Suspended, 
so if SuspendableWorkQueue waits on
WillSuspend state, it may not be woken up correctly. An example is when 
SuspendableWorkQueue is at Suspended state and
the following steps happen:
1. Main thread: SuspendableWorkQueue::resume() => state changed from Suspended 
to Running, notifying background thread
2. Main thread: SuspendableWorkQueue::suspend() => state changed from Running 
to WillSuspend
3. Background thread: woken up and checking state; state is WillSuspend so it 
enters wait again
4. Main thread: SuspendableWorkQueue::resume() => state changed from 
WillSuspend to Running
Since main thread is not notifying background thread at step 4, the background 
thread will keep waiting after resume()
is invoked. To fix this, make sure SuspendableWorkQueue only waits on Suspended 
state.

* Source/WTF/wtf/SuspendableWorkQueue.cpp:
(WTF::SuspendableWorkQueue::suspendIfNeeded):

Canonical link: https://commits.webkit.org/280268@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to