I have a problem with threads.

I have recently compiled and runned code which was an example of multithreading.
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <string>
#include <iostream>
#include <thread>
using namespace std;

void task1(string msg)
{
    cout << "task1 says: " << msg;
}

int main()
{
    thread t1(task1, "Hello");
    t1.join();
}


But when I runned it, I've got that output:
terminate called after throwing an instance of 'std::system_error'
what(): Operation not permitted
I don't know why that code has errored.
Topic archived. No new replies allowed.