#include <thread>
#include <iostream>

using namespace std;


void process1(int & value)
{
    while (this_thread::sleep_for(1s), true)
        ++ value;
}

void process2(int const & value)
{
    while (this_thread::sleep_for(1s), true)
        cout << value << endl;
}

int main()
{
    int i = 0;

    thread t1(process1, ref(i));
    thread t2(process2, ref(i));
    
    t1.join();
    t2.join();
}
