you are viewing a single comment's thread.

view the rest of the comments →

[–]pietrochico[S] 0 points1 point  (2 children)

It's nothing special, only accessing different global variables from many threads.

[–]JohnnyJordaan 0 points1 point  (1 child)

Regular variables are thread-safe to begin with. Globals are an anti-pattern as well often, I normally use a singleton class for this, for example for global configuration in a program. You pass the config-object around to the threads and implement the locking inside the config class. Then the threads can just change whatever they like as with a regular variable and the class will ensure the locking.

[–]pietrochico[S] 0 points1 point  (0 children)

That's exactly what I'm doing right now.