is there enough information?

castironpi at gmail.com castironpi at gmail.com
Tue Feb 26 02:38:00 EST 2008


On Feb 25, 11:52 pm, Paul McGuire <pt... at austin.rr.com> wrote:
> On Feb 25, 9:30 pm, castiro... at gmail.com wrote:
>
>
>
> > Is it enough?
>
> (Reminds me of the movie Marathon Man, in which Dustin Hoffman is
> repeatedly asked by Laurence Olivier, "Is it safe?"  Hoffman had no
> idea what Olivier was talking about.  So Olivier tortured Hoffman some
> more to get the answer.)
>
> Enough for what?
>
> Is "th" short for "thread"?  Maybe a little too short - try "thd" at
> least, and spelling out "thread" isn't out of the question.
>
> What happened to step[0]?  Did you know that lists start at 0?  Why
> are you using a list of synchronization objects?
>
> You would be better off using attributes of th with meaningful names,
> instead of elements of a generically named list attribute, "th.step".
> Names like "th.assign_command_synch", "th.return_value_synch", etc.
> And since there is no synch object that is locked in both methods,
> then the methods will run completely devoid of any synchronization.

I recently ran into a case (* would that be helpful to describe here?)
where thread1 had to do something, thread2 had to do something after
that, and thread1 had to wait for that, then do something else, and
thread2 again had to wait before starting the first thing again.

Clarify:

def thdloop( thd ):
   while thd.cont:
      thd.sig1event.wait()
      ret= thd.cmd()
      thd.sig2event.set()
      thd.seg3event.wait()

and

def consumer( thd ):


EXCEPT that,



More information about the Python-list mailing list