diff options
Diffstat (limited to 'rts/RtsAPI.c')
-rw-r--r-- | rts/RtsAPI.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rts/RtsAPI.c b/rts/RtsAPI.c index 0463f15ad8..c0896f7c6a 100644 --- a/rts/RtsAPI.c +++ b/rts/RtsAPI.c @@ -553,6 +553,14 @@ rts_lock (void) cap = NULL; waitForReturnCapability(&cap, task); + + if (task->incall->prev_stack == NULL) { + // This is a new outermost call from C into Haskell land. + // Until the corresponding call to rts_unlock, this task + // is doing work on behalf of the RTS. + traceTaskCreate(task, cap); + } + return (Capability *)cap; } @@ -586,4 +594,11 @@ rts_unlock (Capability *cap) // Finally, we can release the Task to the free list. boundTaskExiting(task); RELEASE_LOCK(&cap->lock); + + if (task->incall == NULL) { + // This is the end of an outermost call from C into Haskell land. + // From here on, the task goes back to C land and we should not count + // it as doing work on behalf of the RTS. + traceTaskDelete(task); + } } |