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 ;
<win32-file> |dispose
dup add-completion ;
-: share-mode ( -- fixnum )
+: share-mode ( -- n )
{
FILE_SHARE_READ
FILE_SHARE_WRITE