is there enough information?

castironpi at castironpi at
Tue Feb 26 08:45:25 CET 2008

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

def consumer( thd ):
   thd.cmd= function
   ret= thd.result

Except, I missed the shot on the sigevent.clear() placement, and spent
the better part of the day debugging it.

Two options occurred to me, which the first showed up in the earlier
extremely skeletal and cryptic post:  Create a class which will ensure
turn-taking of events, using a get method with and integer index, by
waiting for the prior index to complete before starting the next.

You could name the steps in the class and take a specific order of
them too:

class CmdStep( Step ):
   order= SetCommand, CallCommand, ReadResult

so cmdstep= CmdStep() / with cmdstep.SetCommand: or with
cmdstep[SetCommand]: blocks until the specified time.

The other option, was to join both these threads, execute the command,
then split them again: if that's simpler and just as general, then
Step is cool, but rather useless.

More information about the Python-list mailing list