Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::bind function with its input argument error
From: niXman (i.nixman_at_[hidden])
Date: 2011-09-24 17:23:42


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

2011/9/25 niXman <i.nixman_at_[hidden]>

> tp.schedule(boost::bind(&Model::runTask, &myTask, _1));
>
>
> 2011/9/25 Jack Bryan <dtustudy68_at_[hidden]>
>
>> 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_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>



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