logging from time critical tasks -- QueueListener().stop() takes the whole CPU

Gerlando Falauto gerlando.falauto at gmail.com
Mon Jul 16 01:39:06 EDT 2018


On Monday, July 16, 2018 at 6:56:19 AM UTC+2, dieter wrote:
> > ...
> > Why is the main thread taking up so much CPU?
> > I believe at this point listener.stop() should only be waiting for the helper thread to terminate, which I reckon would be implemented by waiting on a semaphore or something (i.e. iowait i.e. 0% CPU).
> 
> Maybe, you look at the source code of "listener.stop"?

I did, forgot to mention that. Culprit is self._thread.join().
Which is where it waits for the internal thread to terminate,
which I would've expected to wait on a lock or semaphore (pthread_join()?)
So there's something I'm totally missing here, which has more to do
with queues and threads in general than it has with logging.
Any ideas?



More information about the Python-list mailing list