summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorMikolaj Konarski <mikolaj@well-typed.com>2012-07-24 11:41:27 +0200
committerMikolaj Konarski <mikolaj@well-typed.com>2012-07-25 16:24:45 +0200
commitc859d17f9b0ae8559dac4f7e5cb8521e7ab5f0fb (patch)
tree19453acb666d8630365eb9587749dbc271ed161c /rts
parent4666be5d9471b8227f5e24c0b7860e84923489db (diff)
downloadhaskell-c859d17f9b0ae8559dac4f7e5cb8521e7ab5f0fb.tar.gz
Merge taskId and serialisableTaskId
A companion ghc-events pachakge commit displays task ids in the same format.
Diffstat (limited to 'rts')
-rw-r--r--rts/Capability.c4
-rw-r--r--rts/Task.c22
-rw-r--r--rts/Task.h2
3 files changed, 7 insertions, 21 deletions
diff --git a/rts/Capability.c b/rts/Capability.c
index 34e2d9ac11..4c33115ca5 100644
--- a/rts/Capability.c
+++ b/rts/Capability.c
@@ -417,9 +417,9 @@ giveCapabilityToTask (Capability *cap USED_IF_DEBUG, Task *task)
{
ASSERT_LOCK_HELD(&cap->lock);
ASSERT(task->cap == cap);
- debugTrace(DEBUG_sched, "passing capability %d to %s %p",
+ debugTrace(DEBUG_sched, "passing capability %d to %s %#" FMT_HexWord64,
cap->no, task->incall->tso ? "bound task" : "worker",
- (void *)(size_t)task->id);
+ serialisableTaskId(task));
ACQUIRE_LOCK(&task->lock);
if (task->wakeup == rtsFalse) {
task->wakeup = rtsTrue;
diff --git a/rts/Task.c b/rts/Task.c
index 3380cfdb08..78725dd41c 100644
--- a/rts/Task.c
+++ b/rts/Task.c
@@ -395,22 +395,6 @@ workerTaskStop (Task *task)
#endif
-#ifdef DEBUG
-// We don't replace this function with serialisableTaskId,
-// because debug prints as pointers are more readable than random
-// 64-bit intergers (especially on 32-bit architectures)
-// and because we want to use this function also for non-threaded RTS.
-static void *taskId(Task *task)
-{
-#ifdef THREADED_RTS
- return (void *)(size_t)task->id;
-#else
- return (void *)task;
-#endif
-}
-
-#endif
-
#if defined(THREADED_RTS)
static void OSThreadProcAttr
@@ -483,7 +467,8 @@ interruptWorkerTask (Task *task)
ASSERT(osThreadId() != task->id); // seppuku not allowed
ASSERT(task->incall->suspended_tso); // use this only for FFI calls
interruptOSThread(task->id);
- debugTrace(DEBUG_sched, "interrupted worker task %p", taskId(task));
+ debugTrace(DEBUG_sched, "interrupted worker task %#" FMT_HexWord64,
+ serialisableTaskId(task));
}
#endif /* THREADED_RTS */
@@ -497,7 +482,8 @@ printAllTasks(void)
{
Task *task;
for (task = all_tasks; task != NULL; task = task->all_next) {
- debugBelch("task %p is %s, ", taskId(task), task->stopped ? "stopped" : "alive");
+ debugBelch("task %#" FMT_HexWord64 " is %s, ", serialisableTaskId(task),
+ task->stopped ? "stopped" : "alive");
if (!task->stopped) {
if (task->cap) {
debugBelch("on capability %d, ", task->cap->no);
diff --git a/rts/Task.h b/rts/Task.h
index 0926950610..e5b729527d 100644
--- a/rts/Task.h
+++ b/rts/Task.h
@@ -312,7 +312,7 @@ serialisableTaskId (Task *task
#if defined(THREADED_RTS)
return serialiseTaskId(task->id);
#else
- return 1;
+ return (TaskId) (size_t) task;
#endif
}