summaryrefslogtreecommitdiff
path: root/lib/bio
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-07-10 22:33:50 -0700
committerOri Bernstein <ori@eigenstate.org>2018-07-10 22:33:50 -0700
commit22267862832ef46191a23e97a10295f932bf41a8 (patch)
treec9815e348560bb139aba6abb62be7be93b726a57 /lib/bio
parent349fb0a3a44d80d9655037eb660af844bc5a3244 (diff)
downloadmc-22267862832ef46191a23e97a10295f932bf41a8.tar.gz
Make bio and regex disposable.
Diffstat (limited to 'lib/bio')
-rw-r--r--lib/bio/bio.myr8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/bio/bio.myr b/lib/bio/bio.myr
index b76f985..032a926 100644
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -38,11 +38,19 @@ pkg bio =
/* pkg funcs */
pkglocal const ensureread : (f : file#, n : std.size -> std.result(std.size, err))
pkglocal const ensurewrite : (f : file#, n : std.size -> std.result(std.size, err))
+
+ impl disposable file#
;;
const Bufsz = 16*std.KiB
const Small = 512
+impl disposable file# =
+ __dispose__ = {f
+ close(f)
+ }
+;;
+
/* Creates a file from an fd, opened in the given mode. */
const mk = {mode, vt
var f