[EMAIL PROTECTED] a écrit : > Tim and Grant > > > if q.empty(): > return > > > Of course you explanation is understood and ideally should be included > as a note in the Python documentation. And the "not reliable" should > be removed from the documentation! > > Anyway, many thanks for your explanations (I feel "safer" now). > > Olaf >
You could go as far as to say that since the function return itself isn't wrapped in a mutex, the value can be obsolete before even the function returns. ie that code can sometimes return the wrong value : def empty(self): self.acquire_mutex() result = self.count == 0 self.release_mutex() return result before that line, some other thread added a value ! -- http://mail.python.org/mailman/listinfo/python-list