Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Thread with own Callback implementation
From: Eric MALENFANT (Eric.Malenfant_at_[hidden])
Date: 2009-04-23 10:37:27


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);


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net