示例#1
0
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;
}
示例#3
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;
}
示例#4
0
void function_1(LogFile& log)
{
	for (int i = 0; i < 100; i++)
		log.shared_print(string("From t1: "), i);
}
示例#5
0
void childThread(){
	for (int i = 10; i>0; --i)
		f.shared_print("Child", i);
}
示例#6
0
void function_1(LogFile& log) {
    for(int i = 0; i > -1000; --i) 
        log.shared_print("t1", i);
}