projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a6e1fda
)
don't run sparks if there are other threads on this Capability
author
Simon Marlow
<marlowsd@gmail.com>
Fri, 14 Nov 2008 12:10:22 +0000
(12:10 +0000)
committer
Simon Marlow
<marlowsd@gmail.com>
Fri, 14 Nov 2008 12:10:22 +0000
(12:10 +0000)
rts/Capability.c
patch
|
blob
|
history
diff --git
a/rts/Capability.c
b/rts/Capability.c
index
27a2d51
..
8dddbc5
100644
(file)
--- a/
rts/Capability.c
+++ b/
rts/Capability.c
@@
-57,15
+57,18
@@
globalWorkToDo (void)
StgClosure *
findSpark (Capability *cap)
{
StgClosure *
findSpark (Capability *cap)
{
- /* use the normal Sparks.h interface (internally modified to enable
- concurrent stealing)
- and immediately turn the spark into a thread when successful
- */
Capability *robbed;
StgClosurePtr spark;
rtsBool retry;
nat i = 0;
Capability *robbed;
StgClosurePtr spark;
rtsBool retry;
nat i = 0;
+ if (!emptyRunQueue(cap)) {
+ // If there are other threads, don't try to run any new
+ // sparks: sparks might be speculative, we don't want to take
+ // resources away from the main computation.
+ return 0;
+ }
+
// first try to get a spark from our own pool.
// We should be using reclaimSpark(), because it works without
// needing any atomic instructions:
// first try to get a spark from our own pool.
// We should be using reclaimSpark(), because it works without
// needing any atomic instructions: