Commit f17455f5 authored by Georgios Dagkakis's avatar Georgios Dagkakis

wait for elements to move before deciding if buffer has space

parent 0aee6d25
...@@ -17,7 +17,7 @@ f=0.2 ...@@ -17,7 +17,7 @@ f=0.2
maxSimTime=1000 maxSimTime=1000
# the capacity of B123 # the capacity of B123
capacity=45 # float('inf') capacity=3 # float('inf')
class OpQueue(Queue): class OpQueue(Queue):
# allow to be locked between the time periods # allow to be locked between the time periods
...@@ -115,6 +115,7 @@ def controllerMethod(): ...@@ -115,6 +115,7 @@ def controllerMethod():
E.locked=False E.locked=False
if len(M3.getActiveObjectQueue()) and (not M3.state==0): if len(M3.getActiveObjectQueue()) and (not M3.state==0):
Controller.sendSignal(sender=M3, receiver=E,signal=E.isRequested) Controller.sendSignal(sender=M3, receiver=E,signal=E.isRequested)
while len(M3.getActiveObjectQueue()):
yield G.env.timeout(0) yield G.env.timeout(0)
E.locked=True E.locked=True
...@@ -122,6 +123,7 @@ def controllerMethod(): ...@@ -122,6 +123,7 @@ def controllerMethod():
M3.locked=False M3.locked=False
if len(B123.getActiveObjectQueue()) and (not M3.state==0): if len(B123.getActiveObjectQueue()) and (not M3.state==0):
Controller.sendSignal(sender=B123, receiver=M3,signal=M3.isRequested) Controller.sendSignal(sender=B123, receiver=M3,signal=M3.isRequested)
while not len(M3.getActiveObjectQueue()):
yield G.env.timeout(0) yield G.env.timeout(0)
M3.locked=True M3.locked=True
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment