| 95 | } |
| 96 | |
| 97 | void AfterForkParent() { |
| 98 | // The mutex was locked by BeforeFork() |
| 99 | auto handlers = std::move(handlers_while_forking_); |
| 100 | handlers_while_forking_.clear(); |
| 101 | |
| 102 | // Execute handlers in reverse order |
| 103 | for (auto it = handlers.rbegin(); it != handlers.rend(); ++it) { |
| 104 | auto&& handler = *it; |
| 105 | if (handler.handler->parent_after) { |
| 106 | handler.handler->parent_after(std::move(handler.token)); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | mutex_.unlock(); |
| 111 | // handlers will be destroyed here without the mutex locked, so that |
| 112 | // any action taken by destructors might call RegisterAtFork |
| 113 | } |
| 114 | |
| 115 | void AfterForkChild() { |
| 116 | // Need to reinitialize the mutex as it is probably invalid. Also, the |
no test coverage detected