[Oberon] Is it really necessary to hide the list of open file descriptors from the GC?

Артур Ефимов arturefimov at gmail.com
Mon Feb 14 23:26:04 CET 2022


>> (PS: An alternative scheme would be to introduce a reference counter
f.refcnt,
which is increased in Files.Old and decreased in Files.Close, which would in
addition remove a file descriptor from the list if the counter reaches 0.
But that
would make things more complicated).

I'm afraid the reference counter will not solve the issue, because,
firstly, one is
not asked to call Files.Close, one can just leave the file as is, and in
this case the
file descriptor will still need to be collected if there are no references
to it. And,
secondly, Files.Close does not actually "close" the file, but it just
flushes the
buffers, and after Files.Close the file can be still read from and written
to.
More calls to Files.Close can be done later. "Close" means "close the
buffers".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20220215/f4e4f91a/attachment.html>


More information about the Oberon mailing list