void
MessageManager::listen(){
boost::function< void(void) > func;
func = boost::bind( &MessageManager::run, this );
thrd_listen = new boost::thread ( func ); // this line gives the error.
}
and :
void
MessageManager::run(){
stop = false;
string message;
dispatcher = new DispatchedMessage(this, eventManager);
boost::function< void(void) > func;
bool status = SendMessage(new ApplicationNameMessage("HL2", 0));
if( !status )
stop = true;
while (!stop)
{
message = ReceiveMessage();
if( message.length() > 0 )
{
//Thread pour dispatcher
func = boost::bind( &DispatchedMessage::analyser, dispatcher, message );
boost::scoped_ptr<boost::thread> thrd_dispatch ( new boost::thread ( func )); // this line gives the error.
}
else
{
cout<<"Pb : Déconnexion client !"<<endl;
stop = true;
closesocket(csock);
WSACleanup();
}
}
}
I'm a beginer in using boost ant that code has been written by my friend who works on the project with me.
Thanks for your help !