From 2b569f55bdaaeb0cbff16f9e2bf90e14a2fb3139 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Thu, 23 Apr 2009 11:30:02 +0000 Subject: [PATCH] add getOrSetSignalHandlerStore, much like getOrSetTypeableStore Part of the fix for #3171 --- includes/RtsTypeable.h | 17 --------------- rts/Linker.c | 3 ++- rts/RtsStartup.c | 6 +++--- rts/Typeable.c | 56 ------------------------------------------------ 4 files changed, 5 insertions(+), 77 deletions(-) delete mode 100644 includes/RtsTypeable.h delete mode 100644 rts/Typeable.c diff --git a/includes/RtsTypeable.h b/includes/RtsTypeable.h deleted file mode 100644 index 343c514..0000000 --- a/includes/RtsTypeable.h +++ /dev/null @@ -1,17 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The GHC Team, 2006 - * - * Support for shared Typeable - * - * ---------------------------------------------------------------------------*/ - -#ifndef GHC_RTS_TYPEABLE_H -#define GHC_RTS_TYPEABLE_H - -void initTypeableStore(void); -void exitTypeableStore(void); - -StgPtr getOrSetTypeableStore(StgPtr); - -#endif diff --git a/rts/Linker.c b/rts/Linker.c index 4ee28d6..6d7b66a 100644 --- a/rts/Linker.c +++ b/rts/Linker.c @@ -26,7 +26,7 @@ #include "RtsUtils.h" #include "Schedule.h" #include "Sparks.h" -#include "RtsTypeable.h" +#include "RtsGlobals.h" #include "Timer.h" #include "Trace.h" @@ -639,6 +639,7 @@ typedef struct _RtsSymbolVal { SymI_HasProto(freeHaskellFunctionPtr) \ SymI_HasProto(freeStablePtr) \ SymI_HasProto(getOrSetTypeableStore) \ + SymI_HasProto(getOrSetSignalHandlerStore) \ SymI_HasProto(gcdIntegerzh_fast) \ SymI_HasProto(gcdIntegerIntzh_fast) \ SymI_HasProto(gcdIntzh_fast) \ diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c index f10de57..c9edeac 100644 --- a/rts/RtsStartup.c +++ b/rts/RtsStartup.c @@ -30,7 +30,7 @@ #include "ThreadLabels.h" #include "BlockAlloc.h" #include "Trace.h" -#include "RtsTypeable.h" +#include "RtsGlobals.h" #include "Stable.h" #include "Hpc.h" #include "FileLock.h" @@ -243,7 +243,7 @@ hs_init(int *argc, char **argv[]) getStablePtr((StgPtr)blockedIndefinitely_closure); /* initialise the shared Typeable store */ - initTypeableStore(); + initGlobalStore(); /* initialise file locking, if necessary */ #if !defined(mingw32_HOST_OS) @@ -488,7 +488,7 @@ hs_exit_(rtsBool wait_foreign) freeScheduler(); /* free shared Typeable store */ - exitTypeableStore(); + exitGlobalStore(); /* free file locking tables, if necessary */ #if !defined(mingw32_HOST_OS) diff --git a/rts/Typeable.c b/rts/Typeable.c deleted file mode 100644 index 88151b7..0000000 --- a/rts/Typeable.c +++ /dev/null @@ -1,56 +0,0 @@ -/* ----------------------------------------------------------------------------- - * - * (c) The GHC Team, 1995-2005 - * - * Data.Typeable support - * - * ---------------------------------------------------------------------------*/ - -#include "Rts.h" -#include "RtsTypeable.h" - -static StgPtr typeableStore = 0; -#ifdef THREADED_RTS -Mutex typeableStoreLock; -#endif - - -void -initTypeableStore() -{ - typeableStore=0; -#ifdef THREADED_RTS - initMutex(&typeableStoreLock); -#endif -} - -void -exitTypeableStore() -{ -#ifdef THREADED_RTS - closeMutex(&typeableStoreLock); -#endif - if(typeableStore!=0) { - freeStablePtr((StgStablePtr)typeableStore); - typeableStore=0; - } -} - -StgPtr -getOrSetTypeableStore(StgPtr ptr) -{ - StgPtr ret = typeableStore; - if(ret==0) { -#ifdef THREADED_RTS - ACQUIRE_LOCK(&typeableStoreLock); - ret=typeableStore; - if(ret==0) { -#endif - typeableStore = ret = ptr; -#ifdef THREADED_RTS - } - RELEASE_LOCK(&typeableStoreLock); -#endif - } - return ret; -} -- 1.7.10.4