UnixFileHandle.st
changeset 4762 7c403263e1be
child 5409 9b5890348f9c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/UnixFileHandle.st	Sat Sep 18 13:11:28 1999 +0200
@@ -0,0 +1,52 @@
+OSFileHandle subclass:#UnixFileHandle
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'OS-Unix'
+!
+
+!UnixFileHandle primitiveDefinitions!
+%{
+#include <stdio.h>
+%}
+! !
+
+
+!UnixFileHandle methodsFor:'finalization'!
+
+disposed
+    "a file handle was garbage collected - close the underlying file"
+
+%{
+    FILE *f = (FILE *)(__externalAddressVal(self));
+
+    if (f) {
+        __externalAddressVal(self) = NULL;
+        fclose(f);
+    }
+%}
+
+! !
+
+!UnixFileHandle methodsFor:'release'!
+
+close
+    "close the file"
+
+%{
+    FILE *f = (FILE *)(__externalAddressVal(self));
+
+    if (f) {
+        __externalAddressVal(self) = NULL;
+        fclose(f);
+    }
+%}.
+    Lobby unregister:self
+
+! !
+
+!UnixFileHandle class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixFileHandle.st,v 1.1 1999-09-18 11:10:52 cg Exp $'
+! !