The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

363361 (7) [Avatar] Offline
#1
Chapter 7 Listing 7.5 lock_free_stack::pop

Quick question. After this line in lock_free_stack::try_reclaim

node *nodes_to_delete = to_be_deleted.exchange(nullptr);


Isn't the current thread the only one with a pointer to nodes_to_delete? So why isn't it safe to delete nodes_to_delete at this point even if threads_in_pop is greater than zero?

Thanks,
363361 (7) [Avatar] Offline
#2
Sorry - this question is answered further in the text book.