diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-11-12 22:30:20 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-11-12 22:30:20 +0000 |
commit | e68759a4101567a27e306eae0a907baa759ae80c (patch) | |
tree | c90733351cb7a8a02f91725118593c1c4f19c563 /tests/threadtest.cpp | |
parent | 5fb7c972d44a3ce0a067101885d2e0c1966e7c89 (diff) | |
download | YAGE-e68759a4101567a27e306eae0a907baa759ae80c.tar.gz YAGE-e68759a4101567a27e306eae0a907baa759ae80c.zip |
Designing simple preview game
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"; +} |