I just need to convince myself that this is correct. ÂNormally before
reading and writing a flag, there is some sort of locking. ÂWith
taking the mutex before setting the flag, there is now only a lock
around the single writer.
Without taking a lock before reading the flag, will the queue always
be empty is the question. ÂIf it is, then the comment is correct, but
the code assumes not and processes the list again. ÂTesting the flag
after taking the mutex just re-enforces the comment.
Bottom line, does reading the flag need to be lock protected?