Allow fork in thread pool

This commit is contained in:
topjohnwu
2021-10-17 04:24:25 -07:00
parent e8ae103d5f
commit 6f54c57647
3 changed files with 43 additions and 11 deletions
+12
View File
@@ -68,6 +68,18 @@ void unregister_poll(int fd, bool auto_close) {
}
}
void clear_poll() {
if (poll_fds) {
for (auto &poll_fd : *poll_fds) {
close(poll_fd.fd);
}
}
delete poll_fds;
delete poll_map;
poll_fds = nullptr;
poll_map = nullptr;
}
static void poll_ctrl_handler(pollfd *pfd) {
int code = read_int(pfd->fd);
switch (code) {