ccia_code_samples
ccia_code_samples copied to clipboard
Listing 9.6: the local_work_queue is always nullptr
In the function worker_thread(), "local_work_queue" call reset() and then it's not NULL. However, in the function submit(), this variable is always nullptr, so the tasks are pushed into global queue. Why?
My opinion: submit() is called in the main thread, but work_thread() is running in the sub-thread, so their thread_local variable "local_work_queue" are different. Therefore, the condition if(local_work_queue) is always false.