503021 (1) [Avatar] Offline
listing 9.1 instantiates a "thread_safe_queue", which is not part of std and is not defined anywhere else in the book.

I assume it was meant to be "threadsafe_queue" from 6.2?

221421 (1) [Avatar] Offline

same issue in listing 8.1, thread_safe_stack is not defined anywhere. There is a threadsafe_stack (listing 3.5) that I'm trying to include, but I cannot get the code compiled.

The compilation command is

g++ -pthread main_listing_8.1.cpp

Anthony, can you please have a look ?
anthony.williams (216) [Avatar] Offline
The thread-safe queue and stack could be any implementation. Yes, the examples from chapter 6 should work, but so should the examples from chapter 7.
anthony.williams (216) [Avatar] Offline
The threadsafe_stack in your zip file (which looks like the one from listing 6.1) doesn't support move-only types. You need to sprinkle uses of std::move around, as per the attachment.