[BangPypers] Query on correct use of threading

2016-11-08 Thread Rajesh Deo
Dear All, I was exploring the threading module and came up with following, after going through @raymondh's talk (https://www.youtube.com/watch?v=Bv25Dwe84g0) http://pastebin.com/usKE6nME While the code runs fine when ran once or twice, it either deadlocks or waits indefinitely while performing a

Re: [BangPypers] Query on correct use of threading

2016-11-08 Thread Noufal Ibrahim KV
On Tue, Nov 08 2016, Rajesh Deo wrote: > Dear All, > > I was exploring the threading module and came up with following, after > going through @raymondh's talk (https://www.youtube.com/watch?v=Bv25Dwe84g0) > > http://pastebin.com/usKE6nME Can you put it on another pastebin service? My ISP is block

Re: [BangPypers] Query on correct use of threading

2016-11-08 Thread Rajesh Deo
Pls try this: https://bpaste.net/show/4279bfdb091a On Tue, Nov 8, 2016 at 9:33 PM, Noufal Ibrahim KV wrote: > On Tue, Nov 08 2016, Rajesh Deo wrote: > > > Dear All, > > > > I was exploring the threading module and came up with following, after > > going through @raymondh's talk (https://www.yout

Re: [BangPypers] Query on correct use of threading

2016-11-09 Thread Praveen Shirali
Rajesh, The `printer` function loops till the output_queue is empty. The printer thread is done processing when this condition hits. Once this condition is hit, items are no longer fetches from the output_queue. However, the `printer` does not wait _until_ every item from the input_queue has made

Re: [BangPypers] Query on correct use of threading

2016-11-09 Thread Rajesh Deo
Thanks Praveen, the changes you suggested does appear to make this stable. Meanwhile, I figured out that you can use logging module as that is thread-safe and allows you to check each step, and seems like the right way to debug threaded code. I am guessing it was a combination of using "sys.stdou