is there enough information?

castironpi at gmail.com castironpi at gmail.com
Tue Feb 26 02:45:25 EST 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
   thd.sig1event.set()
   thd.sig2event.wait()
   ret= thd.result
   thd.sig3event.set()

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