Broker now operates with events

parent 96b330f0
...@@ -318,8 +318,8 @@ class CoreObject(Process): ...@@ -318,8 +318,8 @@ class CoreObject(Process):
activeObject.receiver=activeObject.selectReceiver(possibleReceivers) activeObject.receiver=activeObject.selectReceiver(possibleReceivers)
activeObject.receiver.giver=activeObject activeObject.receiver.giver=activeObject
#=================================================================== #===================================================================
# TESTING # # TESTING
# print now(), self.id, 'signaling receiver', self.receiver.id # print now(), self.id,' '*50, 'signaling receiver', self.receiver.id
#=================================================================== #===================================================================
activeObject.receiver.isRequested.signal(activeObject) activeObject.receiver.isRequested.signal(activeObject)
return True return True
...@@ -360,8 +360,8 @@ class CoreObject(Process): ...@@ -360,8 +360,8 @@ class CoreObject(Process):
activeObject.giver=activeObject.selectGiver(possibleGivers) activeObject.giver=activeObject.selectGiver(possibleGivers)
activeObject.giver.receiver=activeObject activeObject.giver.receiver=activeObject
#=================================================================== #===================================================================
# TESTING # # TESTING
# print now(), self.id, 'signaling giver', self.giver.id # print now(), self.id,' '*50, 'signaling giver', self.giver.id
#=================================================================== #===================================================================
activeObject.giver.canDispose.signal(activeObject) activeObject.giver.canDispose.signal(activeObject)
return True return True
......
...@@ -53,29 +53,31 @@ class ObjectInterruption(Process): ...@@ -53,29 +53,31 @@ class ObjectInterruption(Process):
# ======================================================================= # =======================================================================
# hand in the control to the objectIterruption.run # hand in the control to the objectIterruption.run
# to be called by the machine # to be called by the machine
# TODO: consider removing this method,
# signalling can be done via Machine request/releaseOperator
# ======================================================================= # =======================================================================
def invoke(self): def invoke(self):
self.call=True self.brokerIsCalled.signal(now())
# ======================================================================= # # =======================================================================
# return control to the Machine.run # # return control to the Machine.run
# ======================================================================= # # =======================================================================
def exit(self): # def exit(self):
self.call=False # self.call=False
# ======================================================================= # # =======================================================================
# call the objectInterruption # # call the objectInterruption
# filter for object interruption - yield waituntil isCalled # # filter for object interruption - yield waituntil isCalled
# ======================================================================= # # =======================================================================
def isCalled(self): # def isCalled(self):
return self.call # return self.call
# ======================================================================= # # =======================================================================
# the objectIterruption returns control to machine.Run # # the objectIterruption returns control to machine.Run
# filter for Machine - yield request/release operator # # filter for Machine - yield request/release operator
# ======================================================================= # # =======================================================================
def isSet(self): # def isSet(self):
return not self.call # return not self.call
#=========================================================================== #===========================================================================
# outputs data to "output.xls" # outputs data to "output.xls"
...@@ -110,7 +112,7 @@ class ObjectInterruption(Process): ...@@ -110,7 +112,7 @@ class ObjectInterruption(Process):
# reactivate the victim # reactivate the victim
#=========================================================================== #===========================================================================
def reactivateVictim(self): def reactivateVictim(self):
self.victim.interruptionEnd.signal(self.victim) self.victim.interruptionEnd.signal(now())
# reactivate(self.victim) # reactivate(self.victim)
#=========================================================================== #===========================================================================
......
This diff is collapsed.
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