Exemplo n.º 1
0
int main()
{
	LogFile log;
	std::thread thread(function, std::ref(log));

	for (int i = 0; i < 100; i++)
		log.print(std::string("From main thread: "), i);

	thread.join();
	return 0;
}
Exemplo n.º 2
0
void function(LogFile& log)
{
	for (int i = 0; i > -100; i--)
		log.print(std::string("From another thread: "), i);
}