The Python Oracle

Who stops my threads?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

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

--

Chapters
00:00 Question
01:09 Accepted answer (Score 2)
01:29 Answer 2 (Score 3)
01:46 Answer 3 (Score 2)
01:58 Answer 4 (Score 1)
02:43 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