Using thread class to manage sending/receiving messages
<p>I have a class that I'm using to manage creation of and destruction of threads that are responsible for sending and receiving CAN messages. I don't know if this is the best way to go about it, so I'm looking for advice on how to manage my threads for send messages and receive messages.</p>

<p>Basically I want spawnThread() to spawn a thread for the object passed to it.
so, something to the effect of</p>

<pre><code>spawnThread(T obj)
{
    std::thread (&amp;T::obj, this);
}
</code></pre>

<p>My expectation was that I would use the Thread class to manage starting and ending the thread for two separate classes SendMessage and ReceiveMessage. Is there a better way to handle threading for sending and receive messages?</p>