I'm using VC++ 2010 with Boost 1.43.
I've just created a class that uses winsock to handle network communication. Now there's a method called "fillQueue" which is defined like this:
Problem is, the method enters an infinite while loop which fills the NetworkQueue with data. So it needs to be in an extra thread. The NetworkQueue class itself is already thread safe.
Now when I want to start an additional thread at the beginning of my app, it needs to be something like a "fire and forget" function call. The thread must be created and needs to live until the program ends.
I've tried the following:
Obviously, this doesn't work, because fillQueue is a bound function. So now I'm looking for the fastest solution to do something like what I had in mind.
TIA
I've just created a class that uses winsock to handle network communication. Now there's a method called "fillQueue" which is defined like this:
Code:
void fillQueue(NetworkQueueTS& nq);
Now when I want to start an additional thread at the beginning of my app, it needs to be something like a "fire and forget" function call. The thread must be created and needs to live until the program ends.
I've tried the following:
Code:
boost::thread whatever(mySock->fillQueue, nq); whatever.detach();
TIA
Comment