From 2aa56b5d9c1a0a92ace9e0503736d35f826133a3 Mon Sep 17 00:00:00 2001 From: sof Date: Sat, 27 Oct 2001 22:05:48 +0000 Subject: [PATCH] [project @ 2001-10-27 22:05:48 by sof] Added Show instance for Concurrent.ThreadId; useful when debugging/diagnosing. --- ghc/includes/PrimOps.h | 3 ++- ghc/rts/Schedule.c | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ghc/includes/PrimOps.h b/ghc/includes/PrimOps.h index 0100f49..ed65437 100644 --- a/ghc/includes/PrimOps.h +++ b/ghc/includes/PrimOps.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: PrimOps.h,v 1.83 2001/09/24 00:22:59 ken Exp $ + * $Id: PrimOps.h,v 1.84 2001/10/27 22:05:48 sof Exp $ * * (c) The GHC Team, 1998-2000 * @@ -792,6 +792,7 @@ EXTFUN_RTS(unblockAsyncExceptionszh_fast); #define myThreadIdzh(t) (t = CurrentTSO) extern int cmp_thread(const StgTSO *tso1, const StgTSO *tso2); +extern int rts_getThreadId(const StgTSO *tso); /* ------------------------------------------------------------------------ Parallel PrimOps diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index b2fb90a..de43f63 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.102 2001/10/23 11:28:51 simonmar Exp $ + * $Id: Schedule.c,v 1.103 2001/10/27 22:05:48 sof Exp $ * * (c) The GHC Team, 1998-2000 * @@ -1399,6 +1399,16 @@ int cmp_thread(const StgTSO *tso1, const StgTSO *tso2) } /* --------------------------------------------------------------------------- + * Fetching the ThreadID from an StgTSO. + * + * This is used in the implementation of Show for ThreadIds. + * ------------------------------------------------------------------------ */ +int rts_getThreadId(const StgTSO *tso) +{ + return tso->id; +} + +/* --------------------------------------------------------------------------- Create a new thread. The new thread starts with the given stack size. Before the -- 1.7.10.4