[m-dev.] diff: mutvar gc problem fix

Peter Ross peter.ross at miscrit.be
Fri Sep 15 01:13:23 AEDT 2000


Hi,


===================================================================


Estimated hours taken: 2

Fix a problem which was preventing the semaphore finalizers from being
run.

extras/concurrency/mutvar.m:
    After getting the value out of a mutvar set the reference to point
    to NULL.  As the reference no longer points to something that is
    garbage collectable on the heap, it is much easier for the gc to
    work out that it can garbage collect the cell and consequently
    garbage collect the semaphore data structures and call their
    finalizers.


Index: mutvar.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/concurrency/mutvar.m,v
retrieving revision 1.1
diff -u -r1.1 mutvar.m
--- mutvar.m	2000/09/08 09:14:54	1.1
+++ mutvar.m	2000/09/14 14:09:06
@@ -113,6 +113,7 @@
 		[will_not_call_mercury, thread_safe],
 "
 	X = *(MR_Word *) Ref;
+	*(MR_Word *) Ref = NULL;
 ").
 
 :- pragma inline(set_ref/2).

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list