c++ - Qt example: no mutex lock when reading, why? -


i looking @ this example, , raises queston me: when looking @ this file mutex being used when accessing global variable m_abort when being changed. when run method reads it, nothing mutex @ all. why?

well, cannot see purpose of mutex @ all. both reading , writing m_abort can performed without mutex protection it's bool variable, , value changed atomically (at least on platforms). , if write not atomic , variable can have inconsistent value - can either false or true, , read true (since value written there true).


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -