Like this: http://liveworkspace.org/code/48075598fce1ae0fef0badc6ea95a1db

2011/9/25 niXman <i.nixman@gmail.com>
tp.schedule(boost::bind(&Model::runTask, &myTask, _1));

2011/9/25 Jack Bryan <dtustudy68@hotmail.com>
Hi,

I am trying to do multithreading by boost::bind. But, I got error:
src/model.cpp:225: instantiated from here
/boost_1_45_0v/include/boost/bind/mem_fn.hpp:333: error: pointer to member type void (Model::)(taskDataSPType&) incompatible with object type taskDataSPT1ype
make: * [model.o] Error 1
Here is my code:
void Model::runTask(taskDataSPType& myTask)
{}

taskDataSPType myTask
;

fifo_pool tp
(thread_num);

for (int i = 0 ; i < totalTaskNum ; +i)
{
    taskQueue
.wait_and_pop(myTask, i);
    myTask
.taskID = i ;
   
// run the typical iterations
    tp
.schedule(boost::bind(&Model::runTask, &myTask));
}
tp
.wait();
In another header file, I have :
typedef struct taskDataSPT1ype taskDataSPType;

struct taskDataSPT1ype
{
   
int taskID;
   
int startNode;
   
int endNode;
};

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users