summaryrefslogtreecommitdiff
path: root/rts/Task.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2013-09-04 10:37:10 +0100
committerSimon Marlow <marlowsd@gmail.com>2013-09-04 11:00:32 +0100
commitaa779e092c4f4d6a6691f3a4fc4074e6359337f8 (patch)
treef4c4e22da3aa71eff569b01af603836d7b5fd6a5 /rts/Task.c
parent5a3918febb7354e0900c4f04151599d833716032 (diff)
downloadhaskell-aa779e092c4f4d6a6691f3a4fc4074e6359337f8.tar.gz
Don't move Capabilities in setNumCapabilities (#8209)
We have various problems with reallocating the array of Capabilities, due to threads in waitForReturnCapability that are already holding a pointer to a Capability. Rather than add more locking to make this safer, I decided it would be easier to ensure that we never move the Capabilities at all. The capabilities array is now an array of pointers to Capabaility. There are extra indirections, but it rarely matters - we don't often access Capabilities via the array, normally we already have a pointer to one. I ran the parallel benchmarks and didn't see any difference.
Diffstat (limited to 'rts/Task.c')
-rw-r--r--rts/Task.c28
1 files changed, 0 insertions, 28 deletions
diff --git a/rts/Task.c b/rts/Task.c
index e6781a17ff..a044bc3672 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -326,34 +326,6 @@ discardTasksExcept (Task *keep)
RELEASE_LOCK(&all_tasks_mutex);
}
-//
-// After the capabilities[] array has moved, we have to adjust all
-// (Capability *) pointers to point to the new array. The old array
-// is still valid at this point.
-//
-void updateCapabilityRefs (void)
-{
- Task *task;
- InCall *incall;
-
- ACQUIRE_LOCK(&all_tasks_mutex);
-
- for (task = all_tasks; task != NULL; task=task->all_next) {
- if (task->cap != NULL) {
- task->cap = &capabilities[task->cap->no];
- }
-
- for (incall = task->incall; incall != NULL; incall = incall->prev_stack) {
- if (incall->suspended_cap != NULL) {
- incall->suspended_cap = &capabilities[incall->suspended_cap->no];
- }
- }
- }
-
- RELEASE_LOCK(&all_tasks_mutex);
-}
-
-
#if defined(THREADED_RTS)
void