Message184972
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. |
|
Date |
User |
Action |
Args |
2013-03-22 15:19:40 | neologix | set | recipients:
+ neologix, jcea, mark.dickinson, pitrou, sbt |
2013-03-22 15:19:40 | neologix | link | issue17389 messages |
2013-03-22 15:19:40 | neologix | create | |
|