diff options
-rw-r--r-- | rts/Schedule.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c index 206c7b4cb6..f97777927a 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -2018,12 +2018,14 @@ forkProcess(HsStablePtr *entry ACQUIRE_LOCK(&sm_mutex); ACQUIRE_LOCK(&stable_ptr_mutex); ACQUIRE_LOCK(&stable_name_mutex); - ACQUIRE_LOCK(&task->lock); for (i=0; i < n_capabilities; i++) { ACQUIRE_LOCK(&capabilities[i]->lock); } + // Take task lock after capability lock to avoid order inversion (#17275). + ACQUIRE_LOCK(&task->lock); + #if defined(THREADED_RTS) ACQUIRE_LOCK(&all_tasks_mutex); #endif |