]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/io/backend/windows/windows.factor
Disposables are now registered in a global disposables set. To take advantage of...
[factor.git] / basis / io / backend / windows / windows.factor
index fde5cf9b12bd12131c1df5ca99e868226dc50b3c..5922e217b0ef299e9f7b536906db9a79e7fbf219 100755 (executable)
@@ -7,33 +7,21 @@ windows.kernel32 windows.shell32 windows.types windows.winsock
 splitting continuations math.bitwise accessors init sets assocs ;
 IN: io.backend.windows
 
-: win32-handles ( -- assoc )
-    \ win32-handles [ H{ } clone ] initialize-alien ;
-
-TUPLE: win32-handle < identity-tuple handle disposed ;
-
-M: win32-handle hashcode* handle>> hashcode* ;
+TUPLE: win32-handle < disposable handle ;
 
 : set-inherit ( handle ? -- )
     [ handle>> HANDLE_FLAG_INHERIT ] dip
     >BOOLEAN SetHandleInformation win32-error=0/f ;
 
 : new-win32-handle ( handle class -- win32-handle )
-    new swap >>handle
-    dup f set-inherit
-    dup win32-handles conjoin ;
+    new-disposable swap >>handle
+    dup f set-inherit ;
 
 : <win32-handle> ( handle -- win32-handle )
     win32-handle new-win32-handle ;
 
-ERROR: disposing-twice ;
-
-: unregister-handle ( handle -- )
-    win32-handles delete-at*
-    [ t >>disposed drop ] [ disposing-twice ] if ;
-
 M: win32-handle dispose* ( handle -- )
-    [ unregister-handle ] [ handle>> CloseHandle win32-error=0/f ] bi ;
+    handle>> CloseHandle win32-error=0/f ;
 
 TUPLE: win32-file < win32-handle ptr ;
 
@@ -54,7 +42,7 @@ HOOK: add-completion io-backend ( port -- )
     <win32-file> |dispose
     dup add-completion ;
 
-: share-mode ( -- fixnum )
+: share-mode ( -- n )
     {
         FILE_SHARE_READ
         FILE_SHARE_WRITE