#include <iostream>
#include <thread>
void foo(int a)
{
std::cout << a << '\n';
}
int main()
{
// Create and execute the thread
std::thread thread{ foo, 10 }; // Pass 10 to free function
// The free function will be executed in a separate thread
// Wait for the thread to finish, this is a blocking operation
thread.join();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dGhyZWFkPgogCnZvaWQgZm9vKGludCBhKQp7CiAgICBzdGQ6OmNvdXQgPDwgYSA8PCAnXG4nOwp9CiAKaW50IG1haW4oKQp7CiAgICAvLyBDcmVhdGUgYW5kIGV4ZWN1dGUgdGhlIHRocmVhZAogICAgc3RkOjp0aHJlYWQgdGhyZWFkeyBmb28sIDEwIH07IC8vIFBhc3MgMTAgdG8gZnJlZSBmdW5jdGlvbgogCiAgICAvLyBUaGUgZnJlZSBmdW5jdGlvbiB3aWxsIGJlIGV4ZWN1dGVkIGluIGEgc2VwYXJhdGUgdGhyZWFkCiAKICAgIC8vIFdhaXQgZm9yIHRoZSB0aHJlYWQgdG8gZmluaXNoLCB0aGlzIGlzIGEgYmxvY2tpbmcgb3BlcmF0aW9uCiAgICB0aHJlYWQuam9pbigpOwogCiAgICByZXR1cm4gMDsKfQ==