Copy callbacks by value in mxs_rworker_broadcast

Copying by reference will not work as the references will refer to the
values passed to the function, not the actual callbacks.
This commit is contained in:
Markus Mäkelä
2018-08-01 13:46:33 +03:00
parent 2939779052
commit 8a248dd930

View File

@ -1018,10 +1018,12 @@ protected:
size_t mxs_rworker_broadcast(void (*cb)(void* data), void* data) size_t mxs_rworker_broadcast(void (*cb)(void* data), void* data)
{ {
return RoutingWorker::broadcast(std::auto_ptr<FunctionTask>(new FunctionTask([&]() std::auto_ptr<FunctionTask> task(new FunctionTask([cb, data]()
{ {
cb(data); cb(data);
}))); }));
return RoutingWorker::broadcast(task);
} }
uint64_t mxs_rworker_create_key() uint64_t mxs_rworker_create_key()