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.

pdavila (10) [Avatar] Offline

Thanks for the book. It's probably the best book that I've seen on Multithreading.

Here is a simple question that keeps bothering me. Let's say that I have a variable accessed by two threads. It makes sense to me that such a variable must be protected by a critical section, since one thread could be writing to it while another thread is reading it. But, let's say that such a variable is ONLY written to before the threads that read the variable start. Once the other threads start to run, they may access the common variable at the same time, as needed, but only to read its value.

Do I ever need to protect access to READONLY variables?