The Python Oracle

Who stops my threads?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Dreamlands

--

Chapters
00:00 Who Stops My Threads?
01:01 Answer 1 Score 2
01:10 Accepted Answer Score 2
01:24 Answer 3 Score 0
01:38 Answer 4 Score 3
01:49 Thank you

--

Full question
https://stackoverflow.com/questions/3620...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #multithreading

#avk47



ANSWER 1

Score 3


If that is the actual code it's pretty obvious: myQueue.get_nowait() raises an Exception (Empty) when the queue is empty!




ANSWER 2

Score 2


stackoverflow? :)




ACCEPTED ANSWER

Score 2


As example, an exception inside the loop will stop the thread.

Why do you use get_nowait() and not get()? What if the Queue is empty?




ANSWER 4

Score 0


GIL? at one time only an interpreter is doing the job if you want true parallelization you must use multiprocessing see http://docs.python.org/library/multiprocessing.html