// I can see "myFunction() running". But my logic never starts to execute.
void myFunction()
{
std::cout << "myFunction() running" << std::endl;
while(1)
{
// some logic...
}
}
thread_pool->enqueue([]()
{
myFunction();
});
I created a thread myself to run my function, and it succeeded. So, that should not be the problem of my funtion, maybe there's a bug or something in the threadpool?
The thread is running well when the function is simple. However, I encountered a stuck thread using my own function. Here is a simple example.
I created a thread myself to run my function, and it succeeded. So, that should not be the problem of my funtion, maybe there's a bug or something in the threadpool?