diff options
Diffstat (limited to 'tests/threadtest.cpp')
-rw-r--r-- | tests/threadtest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/threadtest.cpp b/tests/threadtest.cpp new file mode 100644 index 00000000..dd1877e5 --- /dev/null +++ b/tests/threadtest.cpp @@ -0,0 +1,23 @@ +#include <yage.h> + +#include <iostream> +#include <thread> + +int main() +{ + int n = 5; + + std::cout << "n before: " << n << "\n"; + + auto f = [&] () { + n = 8; + }; + + std::thread t1(f); + + std::cout << "n after: " << n << "\n"; + + t1.join(); + + std::cout << "n after thread: " << n << "\n"; +} |