c++patterns
Create a thread
123456789101112131415161718 | #include <thread>#include <string>#include <functional>void func(std::string str, int& x);void do_something();int main(){ std::string str = "Test"; int x = 5; std::thread t{func, str, std::ref(x)}; do_something(); t.join();} |
This pattern is licensed under the CC0 Public Domain Dedication.