From c69a7dbf0a75e674f7f7fe5578b2bb6f7b0f357c Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 22 Oct 2012 22:26:49 +0100 Subject: [PATCH] Expand the discussion of problems with synchronous finalization. Copied from Perforce Change: 180016 ServerID: perforce.ravenbrook.com --- mps/manual/source/topic/finalization.rst | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mps/manual/source/topic/finalization.rst b/mps/manual/source/topic/finalization.rst index c0ff1609f86..6c7d9fa8d6e 100644 --- a/mps/manual/source/topic/finalization.rst +++ b/mps/manual/source/topic/finalization.rst @@ -41,11 +41,14 @@ message mechanism. .. note:: - This design avoids problems that can result from the :term:`garbage - collector` calling a function in the client program to do the - finalization. In such an implementation, if the client program's - finalization code needs to acquire locks, an unlucky scheduling of - finalization can result in deadlock. See Appendix B of [BOEHM02]_. + This design avoids the problems that can result from the + :term:`garbage collector` calling a function in the client program + to do the finalization. In such an implementation, the client + program's finalization code may end up running concurrently with + other code that accesses the underlying resource, and so access to + the resource need to be guarded with a lock, but then an unlucky + scheduling of finalization can result in deadlock. See [BOEHM02]_ + for a detailed discussion of this issue. The :term:`message type` of finalization messages is :c:func:`mps_message_type_finalization`, and the finalization @@ -228,9 +231,8 @@ Cautions circumstances. This is why Java's ``System.runFinalizersOnExit`` is - deprecated. - - See Appendix A of [BOEHM02]_ for a discussion of this problem. + deprecated. See Appendix A of [BOEHM02]_ for a discussion of + this problem. 4. Not all :term:`pool classes ` support finalization. In general, only pools that manage objects whose liveness is