Boost logo

Boost Users :

Subject: [Boost-users] boost::bind function with its input argument error
From: Jack Bryan (dtustudy68_at_[hidden])
Date: 2011-09-24 17:11:38


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

In another header file, I have :

typedef struct taskDataSPT1ype taskDataSPType;

struct taskDataSPT1ype
    int taskID;
    int startNode;
    int endNode;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at