The initialization of aggregator factory uses call_once to initialize some globally shared variables. When we terminate all the worker threads and create a new group of worker threads, the call_once fails to refresh its state and thus the initialization of aggregator factory fails for the second time.
The initialization of aggregator factory uses
call_once
to initialize some globally shared variables. When we terminate all the worker threads and create a new group of worker threads, thecall_once
fails to refresh its state and thus the initialization of aggregator factory fails for the second time.This can be fixed by simply using std::mutex.