Boost Thread with own Callback implementation

I am using boost::thread for starting a member function of an object in a seperate thread. This works for an example like this: ProcessData *data = new ProcessData(); ProcessManager *pm = new ProcessManager(); boost::thread t1(&ProcessManager::start, boost::ref(pm), data); Unfortunately I am not using the ProcessManager directly but a Controller which uses a self implemented callback functionality. It looks like this: typedef Callback1 startProcessingEvent; startProcessingEvent::Signal onStartProcessing; The ProcessManager is binded to this event and I could call the method like myController->onStartProcessing(data); so in the end the ProcessManager->start is called through the Controller. If I know want to run the same thing in a separate thread I cannot just do this: boost::thread t1(&Controller::onStartProcessing, boost::ref(myController), data); because boost does not understand the whole callback thing. Does anyone has an idea how to solve the problem? Thanks -- View this message in context: http://www.nabble.com/Boost-Thread-with-own-Callback-implementation-tp231938... Sent from the Boost - Users mailing list archive at Nabble.com.

programmine wrote:
It looks like this: typedef Callback1 startProcessingEvent; startProcessingEvent::Signal onStartProcessing;
The ProcessManager is binded to this event and I could call the method like myController->onStartProcessing(data); so in the end the ProcessManager->start is called through the Controller. If I know want to run the same thing in a separate thread I cannot just do this: boost::thread t1(&Controller::onStartProcessing, boost::ref(myController), data); because boost does not understand the whole callback thing. Does anyone has an idea how to solve the problem? Thanks
I'm not sure I understand the "whole callback thing" myself ;-) Trying to guess: Assuming that onStartProcessing is not a member function of Controller, but some sort of functor, you'd write something like: boost::thread t1(myController.onStartProcessing, data);
participants (2)
-
Eric MALENFANT
-
programmine