i have a problem with boost condition, i have these two instance variable within a cpp class:
boost::condition wait_answer_condition;
boost::mutex wait_answer_mutex;
then i have a method that send a message and with on condition:
method1
boost::unique_lock<boost::mutex> lock(wait_answer_mutex)
//do some work and send message
//wait the result
wait_answer_condition.wait(lk);
//get the result
result = responseIdSyncMap[currentRequestID];
then i have another method that receive the result and wakeup the sender thread
method2
int requestID = responseData->getInt32Value("response_id");
responseIdSyncMap.insert(make_pair(requestID, responseData));
wait_answer_condition.notify_one();
the two method are called in different thread. The problem is that when the method2 is called the wait_answer_condition is release before "wait_answer_condition.notify_one()" is called, and the method1 is awaked without found the result.
Anyone has an idea about that?