1

So i have this code

MemoryClass memory;

MyClass mC(false, memory);

loaded in main then i do

std::thread tMC(mC.run, memory);

Which doesn't works. What i want to do is to call mC.run(memory) with the thread

My final goal would be to have a main while loop, and if needed run the sub functions in it without interruption. I need this to make a software that will be console based, and when for example you press "A" will run a certain function then if you press "B" will run the two at the same time

NotanNimda
  • 407
  • 1
  • 3
  • 11

1 Answers1

0

You have to pass the method itself and then pass the implicit this argument and your memory:

std::thread tMC(&MyClass::run, &mC, memory);
Hatted Rooster
  • 35,759
  • 6
  • 62
  • 122