#include <iostream>
#include <cerrno>
#include <fcntl.h>
#include <thread>

int main() {
    std::cout << "Spawning a thread" << std::endl;
    std::cout << "Main thread is: " << std::this_thread::get_id() << std::endl;
    std::cout << "Hardware concurrency: " << std::thread::hardware_concurrency() << std::endl;

    std::thread t1([]() {
        std::cout << "Hello from a thread!!!" << std::endl;
        std::cout << "This is thread: " << std::this_thread::get_id() << std::endl;
    });

    std::cout << "Waiting for a thread" << std::endl;
    t1.join();
    std::cout << "Thread finished" << std::endl;

    return 0;
}
