...

/

Sharing Data Between Threads

Sharing Data Between Threads

This lesson explains how data is shared in between threads.

Chapter overview

The previous chapter was about threads sharing information through message passing. As mentioned in that chapter, message passing is a safe method of concurrency.

Another method involves more than one thread reading from and writing to the same data. For example, the owner thread can start the worker with the address of a bool variable, and the worker can determine whether to terminate or not by reading the current value of that variable. Another example would be ...