add getOrSetSignalHandlerStore, much like getOrSetTypeableStore
authorSimon Marlow <marlowsd@gmail.com>
Thu, 23 Apr 2009 11:30:02 +0000 (11:30 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 23 Apr 2009 11:30:02 +0000 (11:30 +0000)
Part of the fix for #3171

includes/RtsTypeable.h [deleted file]
rts/Linker.c
rts/RtsStartup.c
rts/Typeable.c [deleted file]

diff --git a/includes/RtsTypeable.h b/includes/RtsTypeable.h
deleted file mode 100644 (file)
index 343c514..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* -----------------------------------------------------------------------------
- *
- * (c) The GHC Team, 2006
- *
- *  Support for shared Typeable
- *
- * ---------------------------------------------------------------------------*/\r
-\r
-#ifndef GHC_RTS_TYPEABLE_H\r
-#define GHC_RTS_TYPEABLE_H\r
-\r
-void initTypeableStore(void);\r
-void exitTypeableStore(void);\r
-\r
-StgPtr getOrSetTypeableStore(StgPtr);\r
-\r
-#endif\r
index 4ee28d6..6d7b66a 100644 (file)
@@ -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)                     \
index f10de57..c9edeac 100644 (file)
@@ -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 (file)
index 88151b7..0000000
+++ /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;
-}