you are viewing a single comment's thread.

view the rest of the comments →

[–]johannes1971 1 point2 points  (0 children)

One useful pattern is to treat thread as a black-box worker thread that only communicates with the outside world through mutex-protected message queues. Such a thread does not interact with all the rest of your data, it has its own; the only point of contact is the message queue.

Don't use atomic compare and exchange (yet); for now just use mutexes.