File tree 1 file changed +9
-1
lines changed 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -150,7 +150,10 @@ void thread_pool::stop(bool cancel_work)
150
150
151
151
void thread_pool::stop_before_fork ()
152
152
{
153
- assert (!_p->_num_threads_before_fork );
153
+ // If called multiple times, just keep our saved state
154
+ if (_p->_num_threads_before_fork .load ())
155
+ return ;
156
+
154
157
// NOTE: We shouldn't use _num_running_threads as it has a delay
155
158
_p->_num_threads_before_fork .store (_p->_threads .size ());
156
159
@@ -161,7 +164,12 @@ void thread_pool::stop_before_fork()
161
164
162
165
void thread_pool::resume_after_fork ()
163
166
{
167
+ // If we weren't stopped, just keep running
168
+ if (!_p->_threads .empty ())
169
+ return ;
170
+
164
171
unsigned num_threads = _p->_num_threads_before_fork .load ();
172
+
165
173
auto error_cb = std::move (_p->_error_cb );
166
174
auto task_trace_handler_cb = std::move (_p->_task_trace_handler );
167
175
You can’t perform that action at this time.
0 commit comments