Backport from sid to buster
[hcoop/debian/mlton.git] / basis-library / util / cleaner.sml
CommitLineData
7f918cf1
CE
1(* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 *)
8
9structure Cleaner: CLEANER =
10struct
11
12type t = (unit -> unit) list ref
13
14fun new (): t = ref []
15
16fun addNew (cs, f) = cs := f :: (!cs)
17
18fun clean cs = app (fn c => c () handle _ => ()) (!cs)
19
20val atExit = new ()
21
22val atLoadWorld = new ()
23
24end