In this example, two threads t1 and t2 are created to run function1 and function2 respectively. The join method is used to wait for the completion of the threads before the main thread terminates.

#include <iostream>
#include <thread>

void function1()
{
    std::cout << "Thread 1 executing" << std::endl;
}

void function2()
{
    std::cout << "Thread 2 executing" << std::endl;
}

int main()
{
    std::thread t1(function1);
    std::thread t2(function2);

    std::cout << "Main thread executing" << std::endl;

    t1.join();
    t2.join();

    return 0;
}