|
Boost Users : |
From: jc (k.jayachandran_at_[hidden])
Date: 2007-05-24 12:57:36
hello all
i'm new to boost thread. i'm converting my win32 based thread application to
boost so that in future i can be portable.
this is my code
void CVectorCAN::xlVectorThreadByCh(void){
//do something here
while(m_bVectorThreadAlive){
WaitForSingleObject(m_hxlEventHandle, 50);
xlStatus = XL_SUCCESS;
while(!xlStatus){
if(m_bReceiveStatus){
{
boost::mutex::scoped_lock lock1(m_AckMutex1);
m_bVectorThreadDead = true;
m_cond1.notify_one();
}
return;
}
//process data here
}//while xl_success
}//while the thread is alive
m_bVectorThreadDead = true;
}
int CVectorCAN::KillVectorBoostThread(void){
boost::mutex::scoped_lock lock2(m_AckMutex1);
m_bVectorThreadAlive = false;
m_bReceiveStatus = true;
while(!m_bVectorThreadDead){
m_cond1.wait(lock2);
}
m_pVectorThread->join();
delete m_pVectorThread;
m_pVectorThread = NULL;
return 0;
}
my function deadlocks in the m_cond1.wait(lock2)
i have no idea what i'm doing wrong. any pointer in the right direction will
be great
thanks
-- jc (jayachandran kamaraj)
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