static bool breakThread= false;
void TestMeUsingMiltiThreading(unsigned int uParentID)
{
std::cout << "Thread " << uParentID << " Invoked Current thread " << std::this_thread::get_id();
using namespace std::literals::chrono_literals;
while (!breakThread)
{
std::cout << "Thread " << std::this_thread::get_id() << " is working..." << std::endl;
std::this_thread::sleep_for(1s);//Thread wait for 1s before contuning further
}
}
void TestMeUsingMiltiThreading()
{
std::cout << "Current thread id is=" << std::this_thread::get_id();
using namespace std::literals::chrono_literals;
while (!breakThread)
{
std::cout << "Thread "<< std::this_thread::get_id() <<" is working..."<< std::endl;
std::this_thread::sleep_for(1s);//Thread wait for 1s before contuning further
}
}
.
.
.
int main()
{
.
.
.
std::thread worder(TestMeUsingMiltiThreading); //error here
.
.
.
}
Error: E0289 no instance of constructor "std::thread::thread" matches the argument list
How to fix this, I want to run threads over overloaded functions
Aucun commentaire:
Enregistrer un commentaire