//超时中断
boost::thread api_caller(::api_function, arg1, arg2);
if (api_caller.timed_join(boost::posix_time::milliseconds(500)))
{
//API call returned within 500ms
}
else
{
//API call timed out
}
//采用bind ,ref使其用引用的方式进行值传递
void ReceiveMessage(int msgID, void*& data, long timeout)
void* retdata = NULL;
boost::thread th2(boost::bind(&ReceiveMessage, 1, boost::ref(retdata), 1));
//异常捕获
try{
//---------
}catch(exception & e){
cout<<e.what()<<endl;
}