dimanche 24 novembre 2019

Is count++ atomic operation?

I am using C++11 and have a general question. I have a counter to count number of messages received so it's just a simple "count = count + 1" but my co-worker said I should put a mutex around it. I would think this simple operation only takes a few assembly instructions and it's impossible to be preempted by another thread. I'd like to hear input from experts. Thanks.

Aucun commentaire:

Enregistrer un commentaire