Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a racing condition in ZygoteService
The low-level logic for the ZygoteService uses one server process and multiple client threads in the Zygote process(es). Data is transferred between these threads using shared memory, a mutex and a condition variable. Whenever one of the threads wants to start an operation, it has to wait until the shared memory is in the correct state. With pthread_cond_signal(), it was possible that not the correct thread woke up. For example, client A might have woken up client B, leaving the server thread sleeping and the operation would never be finished. Similarly, the server might not have woken up the client whose request it was currently serving, but a different client which was waiting to start a new request. Using pthread_cond_broadcast() fixes it, the checks whether the threads should really do something are already in place. Fixes rovo89#152.
- Loading branch information