[project @ 2005-03-02 11:06:58 by simonmar]
[ghc-hetmet.git] / ghc / rts / Weak.c
index 787c9e4..012acc9 100644 (file)
 StgWeak *weak_ptr_list;
 
 /*
- * finalizeWeakPointersNow() is called just before the system is shut
- * down.  It runs the finalizer for each weak pointer still in the
- * system.
- *
- * Careful here - rts_evalIO might cause a garbage collection, which
- * might change weak_ptr_list.  Must re-load weak_ptr_list each time
- * around the loop.
- */
-
-void
-finalizeWeakPointersNow(void)
-{
-  StgWeak *w;
-  
-  rts_lock();
-  while ((w = weak_ptr_list)) {
-    weak_ptr_list = w->link;
-    if (w->header.info != &stg_DEAD_WEAK_info) {
-       SET_HDR(w, &stg_DEAD_WEAK_info, w->header.prof.ccs);
-       IF_DEBUG(weak,debugBelch("Finalising weak pointer at %p -> %p\n", w, w->key));
-       if (w->finalizer != &stg_NO_FINALIZER_closure) {
-           rts_evalLazyIO(w->finalizer,NULL);
-           rts_unlock();
-           rts_lock();
-       }
-    }
-  }
-  rts_unlock();
-} 
-
-/*
  * scheduleFinalizers() is called on the list of weak pointers found
  * to be dead after a garbage collection.  It overwrites each object
  * with DEAD_WEAK, and creates a new thread to run the pending finalizers.
@@ -106,7 +75,6 @@ scheduleFinalizers(StgWeak *list)
     arr = (StgMutArrPtrs *)allocate(sizeofW(StgMutArrPtrs) + n);
     TICK_ALLOC_PRIM(sizeofW(StgMutArrPtrs), n, 0);
     SET_HDR(arr, &stg_MUT_ARR_PTRS_FROZEN_info, CCS_SYSTEM);
-    arr->mut_link = NULL;
     arr->ptrs = n;
 
     n = 0;