Antoine Pitrou added the comment: > 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.
Would that be erroneous? It can already happen because of thread switches: e.g. wait() reads True from the flag, then releases the internal lock; another thread gets scheduled in, takes the lock and resets the event; the original thread is resumed and the calling function sees True as the wait() return value even though the event was reset in-between. > Now, it's probably being pedantic, especially because we lack a > memory > model, but that bothers me. As for the memory model, Jeffrey had written a PEP draft years ago: http://code.google.com/p/unladen-swallow/wiki/MemoryModel Unfortunately I can't find the corresponding reference in the python-dev archives again. That said, I agree the performance improvement is probably not important here. It was just drive-by optimization on my part :-) ---------- nosy: +jyasskin _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17389> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com