Maciej Urbański added the comment:

To address @Dima.Tisnek concern I have changed exception message in case thread 
start process is merely in progress.

I kept `self._started` check under a lock so we can avoid more extreme race 
condition of one thread checking `self._started` right before another sets it 
and exits the limbo.

As for testing `self._started` under a lock, but setting it without one. I'm 
avoiding it only because of performance reasons. The read is super cheap, while 
notification of `.set()` is more complex, so if aesthetics are only reasons for 
doing it there then I would advise against holding that lock while executing it.

Of course I could also do a `self in _active` check under a lock, but that is 
slightly more costly, than `self._started` check and not any more useful.

I may be prematurely optimizing things, but people tend to like they threads to 
startup ASAP.

----------
Added file: http://bugs.python.org/file44677/issue27908_2.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27908>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to