I'm learning to use the ASIO library and I am trying to start a custom handler after an asynchronous read.
void myConnection::start()
{
conSocket.async_read_some(asio::buffer(conIOBuf),
[this](const std::error_code error, std::size_t length)
{
std::cout << "LOG: Starting Callback\n";
myQStrand.post(
[this, &error]
{
pushToMyQ(privateQ, error);
});
});
}
I've used gdb to debug the executable, however when I run it I get a segmentation fault at the pushToMyQ line in the code. I have checked both error and privateQ, they both have valid addresses and when their member functions are called they work.
myConnection is a child from a purely virtual parent class to keep the naming and some of the accessors constant between another class. privateQ is held by a manager class that passes the queue by reference to myConnection which holds it as a private member.
What could be causing the segmentation fault to happen in the lambda at the line where pushToMyQ is being executed?
Aucun commentaire:
Enregistrer un commentaire