mutex remove_poll_fd()

It modifies talk_data.fds which can also be modified from the main
thread when adding a writer.
This commit is contained in:
Kovid Goyal 2018-03-02 11:13:47 +05:30
parent 6214a87522
commit bfbbe3db14
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1049,6 +1049,7 @@ read_from_peer(ChildMonitor *self, int s) {
static inline void
remove_poll_fd(int fd) {
peer_mutex(lock);
size_t count = talk_data.num_talk_fds + talk_data.num_listen_fds;
for (size_t i = talk_data.num_listen_fds; i < count; i++) {
struct pollfd *pfd = talk_data.fds + i;
@ -1059,6 +1060,7 @@ remove_poll_fd(int fd) {
break;
}
}
peer_mutex(unlock);
}
static inline void