Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
12aee243
Commit
12aee243
authored
Apr 14, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
now Machine waits also for interruption event while waiting for a signal from the giver
parent
7410134f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
dream/simulation/Machine.py
dream/simulation/Machine.py
+14
-3
No files found.
dream/simulation/Machine.py
View file @
12aee243
...
...
@@ -211,9 +211,20 @@ class Machine(CoreObject):
def
run
(
self
):
# execute all through simulation time
while
1
:
# wait until the machine can accept an entity and one predecessor requests it
# canAcceptAndIsRequested is invoked to check when the machine requested to receive an entity
yield
waitevent
,
self
,
self
.
isRequested
# waitEvent isRequested or interruption start
while
1
:
yield
waitevent
,
self
,
[
self
.
isRequested
,
self
.
interruptionStart
]
# if the machine is interrupted
if
self
.
interruptionStart
.
signalparam
==
now
():
# wait until the interruption is ended
yield
waitevent
,
self
,
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
assert
self
==
self
.
interruptionEnd
.
signalparam
,
'the victim of the failure is not the object that received it'
# and signal the Giver, otherwise wait until it is requested
if
self
.
signalGiver
():
break
# if the machine can accept an entity and one predecessor requests it continuew with receiving the entity
else
:
break
# TODO: maybe here have to assigneExit of the giver and add self to operator activeCallers list
requestingObject
=
self
.
isRequested
.
signalparam
assert
requestingObject
==
self
.
giver
,
'the giver is not the requestingObject'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment