| 132 | } |
| 133 | |
| 134 | void RegisterAtFork(std::weak_ptr<AtForkHandler> weak_handler) { |
| 135 | std::lock_guard<std::mutex> lock(mutex_); |
| 136 | // This is O(n) for each at-fork registration. We assume that n remains |
| 137 | // typically low and calls to this function are not performance-critical. |
| 138 | MaintainHandlersUnlocked(); |
| 139 | handlers_.push_back(std::move(weak_handler)); |
| 140 | } |
| 141 | |
| 142 | std::mutex mutex_; |
| 143 | std::vector<std::weak_ptr<AtForkHandler>> handlers_; |
no test coverage detected