我正在尝试在主函数中为 ThreadMe 类中名为 thefunction() 的函数创建一个线程。棘手的部分是我需要在另一个类 TYIA -Roland 中启动一个线程
#include <iostream>
#include <process.h>
#include <windows.h>
int main() {
char cincatcher[24];
std::cout << "I want to run a thread using a function on another class\n";
// Here is a good place to start the thread
while( true ) {
std::cin >> cincatcher
}
}
class ThreadMe {
void thefunction();
};
void ThreadMe::thefunction() {
while( true ) {
std::cout << "working!\n"
Sleep(800);
}
}