c++ - cloud 9 execute thread -
i running code in c++ on c9 , getting error:
terminate called after throwing instance of 'std::system_error' what(): enable multithreading use std::thread: operation not permitted.
although file compile after adding command line -wl,--no-as-needed , -lpthread, run function on cloud 9 still response same error
` try run on bash , it's working still want run regular run function(known f5) able use debugger
here example of code:
#include <iostream> #include <thread> void foo() { // stuff... } void bar(int x) { // stuff... } int main() { std::thread first (foo); // spawn new thread calls foo() std::thread second (bar,0); // spawn new thread calls bar(0) std::cout << "main, foo , bar execute concurrently...\n"; // synchronize threads: first.join(); // pauses until first finishes second.join(); // pauses until second finishes std::cout << "foo , bar completed.\n"; return 0; }
Comments
Post a Comment