diff options
author | Andy Wingo <wingo@pobox.com> | 2016-04-03 11:39:21 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-04-04 16:30:56 +0200 |
commit | 67b147fb7a5e8771b0314fcc0fcc826db09d9949 (patch) | |
tree | 16fb15deb0f53abbd4dfc8e511a4443aba775a66 /NEWS | |
parent | 4460f1f15280e3378633115fe9035448a68c636b (diff) |
Remove port free functions; just close instead
* libguile/ports.h (scm_t_port_type_flags): Replace
SCM_PORT_TYPE_HAS_FLUSH with SCM_PORT_TYPE_NEEDS_CLOSE_ON_GC.
(scm_t_ptob_descriptor): Remove free function.
* libguile/ports.c (scm_set_port_needs_close_on_gc): New function.
(scm_set_port_flush): Don't set flags.
(scm_c_make_port_with_encoding, scm_close_port): Use the new flag to
determine when to add a finalizer and also when to include the port in
the weak set.
(scm_set_port_free): Remove.
(do_close, finalize_port): Close port instead of calling free
function.
* libguile/r6rs-ports.c (initialize_transcoded_ports):
* libguile/vports.c (scm_make_sfptob):
* libguile/fports.c (scm_make_fptob): Mark these ports as needing close
on GC.
* libguile/fports.c (fport_free): Remove.
* NEWS: Update.
* doc/ref/api-io.texi (Port Implementation): Update.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -24,6 +24,17 @@ as arguments to the `setvbuf' function. Port mark functions have not been called since the switch to the BDW garbage collector. +** Remove `scm_set_port_free' + +It used to be that if an open port became unreachable, a special "free" +function would be called instead of the "close" function. Now that the +BDW-GC collector allows us to run arbitrary code in finalizers, we can +simplify to just call "close" on the port and remove the separate free +functions. Note that hooking into the garbage collector has some +overhead. For that reason Guile exposes a new interface, +`scm_set_port_needs_close_on_gc', allowing port implementations to +indicate to Guile whether they need closing on GC or not. + Changes in 2.1.2 (changes since the 2.1.1 alpha release): |