Commit | Line | Data |
---|---|---|
6e9ec86d AW |
1 | #ifndef SCM_FINALIZERS_H |
2 | #define SCM_FINALIZERS_H | |
3 | ||
d6651f69 | 4 | /* Copyright (C) 2012, 2013, 2014 Free Software Foundation, Inc. |
6e9ec86d AW |
5 | * |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public License | |
8 | * as published by the Free Software Foundation; either version 3 of | |
9 | * the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, but | |
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU Lesser General Public | |
17 | * License along with this library; if not, write to the Free Software | |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | |
19 | * 02110-1301 USA | |
20 | */ | |
21 | ||
22 | \f | |
23 | ||
24 | #include "libguile/__scm.h" | |
25 | ||
26 | \f | |
27 | ||
28 | typedef void (*scm_t_finalizer_proc) (void *obj, void *data); | |
29 | ||
30 | SCM_INTERNAL void scm_i_set_finalizer (void *obj, scm_t_finalizer_proc, | |
31 | void *data); | |
32 | SCM_INTERNAL void scm_i_add_finalizer (void *obj, scm_t_finalizer_proc, | |
33 | void *data); | |
34 | SCM_INTERNAL void scm_i_add_resuscitator (void *obj, scm_t_finalizer_proc, | |
35 | void *data); | |
36 | ||
eaf99988 AW |
37 | SCM_INTERNAL void scm_i_finalizer_pre_fork (void); |
38 | ||
a0551390 AW |
39 | /* CALLBACK will be called on OBJ after each garbage collection, as long |
40 | as OBJ is accessible. It will be called from a finalizer, which may | |
41 | be from an async or from another thread. */ | |
42 | SCM_INTERNAL void scm_i_register_weak_gc_callback (SCM obj, void (*callback) (SCM)); | |
43 | ||
d6651f69 AW |
44 | SCM_API int scm_set_automatic_finalization_enabled (int enabled_p); |
45 | SCM_API int scm_run_finalizers (void); | |
46 | ||
6e9ec86d | 47 | SCM_INTERNAL void scm_init_finalizers (void); |
eaf99988 | 48 | SCM_INTERNAL void scm_init_finalizer_thread (void); |
6e9ec86d AW |
49 | |
50 | #endif /* SCM_FINALIZERS_H */ |