MultiThreading
|
Assume a simple situation with a single global variable of type string, one access function for writing and one access function for reading the value:
Within a multithreaded environment multiple threads may call the access functions:
Running the program leads to an output similar to C++ Example: Running threads with unsynchronized data access
Within source code the variable is set to one of the two values "ABCDEFGHIJK" and "___________". But because of the missing synchronization a random mix of the possible values can be observed.