This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author neologix
Recipients jcea, mark.dickinson, neologix, pitrou, sbt
Date 2013-03-22.15:19:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CAH_1eM3SSiu9_fQooJPCB+QwJ4vrFHhdYSfB2yHW3qctmzqPsw@mail.gmail.com>
In-reply-to <1362928789.23.0.730177284383.issue17389@psf.upfronthosting.co.za>
Content
Something bothers me:
"""
def wait(self, timeout=None):
    if self._flag:
        return True

    self._cond.acquire()
"""

The _flag is checked without any lock held: although it won't be a
problem with CPython, a standard memory model (e.g. Java's one)
doesn't guarantee that reading _flag outside of the lock will return
the value most recently written to it (because of caching/hoisting, or
store buffers/invalidate queues at CPU level).

So in short, if wait() is called by a thread shortly after another
thread clear()ed it, the former thread might very well read _flag ==
True (while the later just set it to False) and return erroneously.

Now, it's probably being pedantic, especially because we lack a memory
model, but that bothers me.

Also, I'm not sure this is really a hot-path.
History
Date User Action Args
2013-03-22 15:19:40neologixsetrecipients: + neologix, jcea, mark.dickinson, pitrou, sbt
2013-03-22 15:19:40neologixlinkissue17389 messages
2013-03-22 15:19:40neologixcreate