On 05/21/2011 12:11 AM, Eric Blake wrote:
I think we're safe. It shouldn't matter if thread 2 reads
thread 3's
answer (because they are both read-only queries, and should be getting
the same answer; or even if the answers differ, reading the newer answer
is not horrible because it is still an accurate answer).
The queries could be for different disks, and one might fail. The
problem is mostly if the first fails and the second succeeds, and the
program sees a success instead of a failure.
... but a much simpler fix is to make statRetCode a pointer, so that
there is nothing to do on the producer side after the flag has been
reset. I strongly suggest doing this, as it is a very simple change
that Cannot Make Things Worse (TM).
Paolo