[GHC] #11713: STM Finalizers

GHC ghc-devs at haskell.org
Wed Mar 16 14:07:29 UTC 2016


#11713: STM Finalizers
-------------------------------------+-------------------------------------
           Reporter:  mc.schroeder   |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Runtime        |           Version:  8.1
  System                             |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This is some work I did as part of my master's thesis [1]. It's an
 extension to GHC's STM implementation. The main idea is to introduce a new
 primitive function
 {{{#!hs
     atomicallyWithIO :: STM a -> (a -> IO b) -> IO b
 }}}

 Like the existing atomically operation, atomicallyWithIO performs an STM
 computation. Additionally, it takes a '''finalizer''', which is an
 arbitrary I/O action that can depend on the result of the STM computation,
 and combines it with the transaction in such a way that:

 1. The finalizer is only performed if the STM transaction is guaranteed to
 commit.
 2. The STM transaction only commits if the finalizer finishes without
 raising an exception.

 A detailed specification, including an operational semantics, as well as a
 discussion of the implementation, can be found in chapter 2 of my thesis
 [1].

 ----

 I actually did this work quite some time ago, and even announced it on the
 mailing list [2] to some positive feedback, but then never got around to
 actually submitting a patch. Last week Charles Strahan wrote me on GitHub
 and got me motivated again, so here I am :)

 I'm submitting a code review to Phabricator right now and will link it to
 this ticket.

 ----
 [1] https://github.com/mcschroeder/thesis

 [2] https://mail.haskell.org/pipermail/haskell-cafe/2015-July/120589.html

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11713>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list