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
8a609356
Commit
8a609356
authored
Apr 19, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor corrections to queue. removeEntity of Queue now also signalReceiver
parent
b14819d8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
dream/simulation/Queue.py
dream/simulation/Queue.py
+10
-5
No files found.
dream/simulation/Queue.py
View file @
8a609356
...
@@ -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
# =======================================================================
# =======================================================================
...
...
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