diff --git a/listings/listing_2.6.cpp b/listings/listing_2.6.cpp index f08fff6..3e9f660 100644 --- a/listings/listing_2.6.cpp +++ b/listings/listing_2.6.cpp @@ -22,6 +22,8 @@ class scoped_thread void do_something(int& i) { ++i; + if (i % 100000 == 0) + printf("%d\n", i); } struct func @@ -45,7 +47,8 @@ void do_something_in_current_thread() void f() { int some_local_state; - scoped_thread t(std::thread(func(some_local_state))); + // scoped_thread t(std::thread(func(some_local_state))); + scoped_thread t(std::move(std::thread(func(some_local_state)))); do_something_in_current_thread(); }