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.
Basically I want spawnThread() to spawn a thread for the object passed to it. so, something to the effect of
spawnThread(T obj)
{
std::thread (&T::obj, this);
}
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?