int main(){ std::thread t1(childThread); for (int i = 0; i < 10; ++i){ f.shared_print("Main", i); } t1.join(); }
int main() { LogFile log; thread t1(function_1, ref(log)); for(int i = 0; i < 100; ++i) { log.shared_print(string("From main: "), i); } t1.join(); return 0; }
int main() { LogFile log; Fctor fctor(log); std::thread t1(fctor); for (int i=0; i<100; i++) log.shared_print("main", i); t1.join(); return 0; }
void function_1(LogFile& log) { for (int i = 0; i < 100; i++) log.shared_print(string("From t1: "), i); }
void childThread(){ for (int i = 10; i>0; --i) f.shared_print("Child", i); }
void function_1(LogFile& log) { for(int i = 0; i > -1000; --i) log.shared_print("t1", i); }