7 Dec 19:50
queueing activations?
Alan Marchiori <alan <at> alanmarian.com>
2009-12-07 18:50:45 GMT
2009-12-07 18:50:45 GMT
Hi,
I'm just getting started with SimPy and maybe am a bit confused about
how to queue events... I made this simple example:
<code>
from SimPy.Simulation import *
class AProcess(Process):
def __init__(self):
Process.__init__(self)
def callback(self):
while True:
print "awake at", now()
yield passivate, self
def main():
initialize() # required
a = AProcess()
activate(a, a.callback(), at=10.0)
reactivate(a, at=11)
reactivate(a, at=12)
simulate(until=100)
if __name__ == '__main__': main()
</code>
the output is:
awake at 12
I expected the output to be:
awake at 10
awake at 11
awake at 12
Is this sort of behavior possible (where activations are queued?) ?
Thanks,
------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing.
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
RSS Feed