Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Can n be greater than zero if we do count = 0 first?
static unsigned long count = 0;
why is mutex hereThink what will happen. if two threads stumble upon an increment at the same time without synchronization. Especially with the existence of a cache, the presence of optimizations that consolidate writing to memory, and the like. In fact, it's better to use atomic here, but oh well.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question