Multi-threaded operations

#include <iostream>
#include <thread>
#include "unistd.h"
using namespace std;

int add(int a, int b) {
    sleep(3);
    return a + b;
}

thread t([] {
    int result = add(35);
    cout << "result: " << result << endl;
});

cout << "main thread\n";
t.detach();
//output:
//main thread
//result: 8