4762
|
1 |
OSFileHandle subclass:#UnixFileDescriptorHandle
|
|
2 |
instanceVariableNames:''
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'OS-Unix'
|
|
6 |
!
|
|
7 |
|
|
8 |
!UnixFileDescriptorHandle primitiveDefinitions!
|
|
9 |
%{
|
|
10 |
#include <stdio.h>
|
|
11 |
%}
|
|
12 |
|
|
13 |
! !
|
|
14 |
|
|
15 |
|
|
16 |
!UnixFileDescriptorHandle methodsFor:'finalization'!
|
|
17 |
|
|
18 |
disposed
|
|
19 |
"a filedescriptor was garbage collected - close the underlying file"
|
|
20 |
|
|
21 |
%{
|
|
22 |
INT fd = (INT)(__externalAddressVal(self));
|
|
23 |
|
|
24 |
if (fd > 0) {
|
|
25 |
__externalAddressVal(self) = (OBJ)-1;
|
|
26 |
close(fd);
|
|
27 |
}
|
|
28 |
%}.
|
|
29 |
|
|
30 |
! !
|
|
31 |
|
|
32 |
!UnixFileDescriptorHandle methodsFor:'release'!
|
|
33 |
|
|
34 |
close
|
|
35 |
"close the file"
|
|
36 |
|
|
37 |
%{
|
|
38 |
INT fd = (INT)(__externalAddressVal(self));
|
|
39 |
|
|
40 |
if (fd > 0) {
|
|
41 |
__externalAddressVal(self) = (OBJ)-1;
|
|
42 |
close(fd);
|
|
43 |
}
|
|
44 |
%}.
|
|
45 |
Lobby unregister:self
|
|
46 |
|
|
47 |
|
|
48 |
! !
|
|
49 |
|
|
50 |
!UnixFileDescriptorHandle class methodsFor:'documentation'!
|
|
51 |
|
|
52 |
version
|
|
53 |
^ '$Header: /cvs/stx/stx/libbasic/UnixFileDescriptorHandle.st,v 1.1 1999-09-18 11:11:04 cg Exp $'
|
|
54 |
! !
|