Closed schveiguy closed 6 hours ago
This does not work. once the thread is deregistered, if it has a pending signal, it's be suspended and never resumed.
No, because the signal could be pending, or could have been received and then the state is delayed.
Since we know the thread is going away and about to be removed from the list, the right answer is to mark somehow that the thread should ignore the signal.
I think I know how to do this -- enterBusyState, but never exit. Then the signal will be ignored, and it won't suspend.
That wasn't the expected solution, but i think it works.
The obvious follow up question for me is whether we should start thread in busy state right away. That seems like the right thing to do.
The mThreadList lock is taken while doing a whole host of things, such as scanning, or signaling.
If we don't enter the busy state, we could be paused while holding the lock to remove the thread, and this will deadlock the collection.