minor corrections to queue. removeEntity of Queue now also signalReceiver

parent b14819d8
...@@ -95,16 +95,17 @@ class Queue(CoreObject): ...@@ -95,16 +95,17 @@ class Queue(CoreObject):
yield waitevent, self, [self.isRequested,self.canDispose] yield waitevent, self, [self.isRequested,self.canDispose]
# if the event that activated the thread is isRequested then getEntity # if the event that activated the thread is isRequested then getEntity
if self.isRequested.signalparam: if self.isRequested.signalparam:
# reset the isRequested signal parameter
self.isRequested.signalparam=None
self.getEntity() self.getEntity()
#if entity just got to the dummyQ set its startTime as the current time #if entity just got to the dummyQ set its startTime as the current time
if self.isDummy: if self.isDummy:
activeObjectQueue[0].startTime=now() activeObjectQueue[0].startTime=now()
# reset the isRequested signal parameter
self.isRequested.signalparam=None
# if the event that activated the thread is canDispose then signalReceiver # if the event that activated the thread is canDispose then signalReceiver
if self.haveToDispose(): if self.haveToDispose():
self.signalReceiver() self.signalReceiver()
# ======================================================================= # =======================================================================
# checks if the Queue can accept an entity # checks if the Queue can accept an entity
# it checks also who called it and returns TRUE # it checks also who called it and returns TRUE
...@@ -117,7 +118,7 @@ class Queue(CoreObject): ...@@ -117,7 +118,7 @@ class Queue(CoreObject):
#if we have only one predecessor just check if there is a place available #if we have only one predecessor just check if there is a place available
# this is done to achieve better (cpu) processing time # this is done to achieve better (cpu) processing time
# then we can also use it as a filter for a yield method # then we can also use it as a filter for a yield method
if(len(activeObject.previous)==1 or callerObject==None): if(callerObject==None):
return len(activeObjectQueue)<activeObject.capacity return len(activeObjectQueue)<activeObject.capacity
thecaller=callerObject thecaller=callerObject
return len(activeObjectQueue)<activeObject.capacity and (thecaller in activeObject.previous) return len(activeObjectQueue)<activeObject.capacity and (thecaller in activeObject.previous)
...@@ -148,6 +149,10 @@ class Queue(CoreObject): ...@@ -148,6 +149,10 @@ class Queue(CoreObject):
activeEntity=CoreObject.removeEntity(self, entity) #run the default method activeEntity=CoreObject.removeEntity(self, entity) #run the default method
if self.canAccept(): if self.canAccept():
self.signalGiver() self.signalGiver()
# TODO: disable that for the mouldAssemblyBuffer
if not self.__class__.__name__=='MouldAssemblyBuffer':
if self.haveToDispose():
self.signalReceiver()
return activeEntity return activeEntity
# ======================================================================= # =======================================================================
......
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