mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 05:45:33 +00:00
![Thomas Zimmermann](/assets/img/avatar_default.png)
When closing a socket from within the main thread, we need to make sure that the I/O thread does not operate on the related instance of UnixSocketImpl. With this patch, the main thread posts a SocketCloseTask to the I/O thread. The SocketCloseTask removes the socket from the I/O thread's list of watched file descriptors and dispatches an instance of DeleteInstanceRunnable for the socket's UnixSocketImpl, which cleans up the data structures. These steps serialize the close operation within the I/O thread, and ensure that the main thread processed all other dispatched runnables that may use the UnixSocketImpl.