Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 3:07 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > > > I pasted my current solution athttp://codepad.org/FXF2SWmg. Any > > feedback, especially if it has to do with proving or disproving its > > correctness, will be appreciat

Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 10:13 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 10 Jun 2008 22:46:37 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> > wrote: > >On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > >> I had a little trouble understanding what exact problem it is that you ar

Re: Producer-consumer threading problem

2008-06-11 Thread Aahz
In article <[EMAIL PROTECTED]>, George Sakkis <[EMAIL PROTECTED]> wrote: > >I'd like some feedback on a solution to a variant of the producer- >consumer problem. My first few attempts turned out to deadlock >occasionally; this one seems to be deadlock-free so far but I can't >tell if it's provably

Re: Producer-consumer threading problem

2008-06-11 Thread Carl Banks
On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I pasted my current solution athttp://codepad.org/FXF2SWmg. Any > feedback, especially if it has to do with proving or disproving its > correctness, will be appreciated. It seems like you're reinventing the wheel. The Queue class do

Re: Producer-consumer threading problem

2008-06-11 Thread Rhamphoryncus
On Jun 11, 6:00 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jun 11, 1:59 am, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > > > Why not use a normal Queue, put a dummy value (such as None) in when > > you're producer has finished, and have the main thread use the normal > > Thread.join() method o

Re: Producer-consumer threading problem

2008-06-11 Thread Jean-Paul Calderone
On Tue, 10 Jun 2008 22:46:37 -0700 (PDT), George Sakkis <[EMAIL PROTECTED]> wrote: On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: I had a little trouble understanding what exact problem it is that you are trying to solve but I'm pretty sure that you can do it with one of two metho

Re: Producer-consumer threading problem

2008-06-11 Thread Larry Bates
George Sakkis wrote: On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: I had a little trouble understanding what exact problem it is that you are trying to solve but I'm pretty sure that you can do it with one of two methods: Ok, let me try again with a different example: I want to d

Re: Producer-consumer threading problem

2008-06-11 Thread giltay
> Sounds like a sentinel would work for this. The producer puts a > specific object (say, None) in the queue and the consumer checks for > this object and stops consuming when it sees it. But that seems so > obvious I suspect there's something else up. There's a decent implementation of thi

Re: Producer-consumer threading problem

2008-06-11 Thread George Sakkis
On Jun 11, 1:59 am, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > Why not use a normal Queue, put a dummy value (such as None) in when > you're producer has finished, and have the main thread use the normal > Thread.join() method on all your child threads? I just gave two reasons: - Concurrency / in

Re: Producer-consumer threading problem

2008-06-10 Thread Carl Banks
On Jun 10, 11:33 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > I'd like some feedback on a solution to a variant of the producer- > consumer problem. My first few attempts turned out to deadlock > occasionally; this one seems to be deadlock-free so far but I can't > tell if it's provably correct,

Re: Producer-consumer threading problem

2008-06-10 Thread Rhamphoryncus
Why not use a normal Queue, put a dummy value (such as None) in when you're producer has finished, and have the main thread use the normal Thread.join() method on all your child threads? -- http://mail.python.org/mailman/listinfo/python-list

Re: Producer-consumer threading problem

2008-06-10 Thread George Sakkis
On Jun 10, 11:47 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > I had a little trouble understanding what exact problem it is that you are > trying to solve but I'm pretty sure that you can do it with one of two > methods: Ok, let me try again with a different example: I want to do what can be ea

Re: Producer-consumer threading problem

2008-06-10 Thread Larry Bates
George Sakkis wrote: I'd like some feedback on a solution to a variant of the producer- consumer problem. My first few attempts turned out to deadlock occasionally; this one seems to be deadlock-free so far but I can't tell if it's provably correct, and if so, whether it can be simplified. The g