View Single Post
Old 12-13-2010, 04:47 AM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
My guess is that this can happen if the CoverFetcher is still alive when OK is pushed.

Threads have a terminate() method (can't find one in the __dict__ for a thread), so the once started the thread will happily continue to do its thing until it comes to a natural finish. Tests show that python lets the thread continue running. What this means is that we could conceivably have multiple CoverFetcher threads running at the same time. I don't know if this will create concurrency problems elsewhere.

It seems that the code is written to permit CoverFetcher to be a process. At least, the terminate code is written that way. Actually using a process would eliminate the multiple running threads problem, but of course would create more problems with passing information back and forth.

My suggestion is that unless there is a good reason for leaving them active, the buttons should be disabled while cover searching is happening. That way the thread can never be left hanging, which eliminates the possible concurrency issues.
chaley is offline   Reply With Quote