Fixes
parent
eafa0d792c
commit
d6f4b25abe
|
|
@ -23,7 +23,7 @@ HELP: close-later
|
||||||
|
|
||||||
HELP: with-destructors
|
HELP: with-destructors
|
||||||
{ $values { "quot" "a quotation" } }
|
{ $values { "quot" "a quotation" } }
|
||||||
{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link (destruct) } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." }
|
{ $description "Calls a quotation within a new dynamic scope. This quotation may register destructors, on any object, by wrapping the object in a destructor and implementing " { $link destruct } " on that object type. After the quotation finishes, if an error was thrown, all destructors are called and the error is then rethrown. However, if the quotation was successful, only those destructors created with an 'always cleanup' flag will be destroyed." }
|
||||||
{ $notes "Destructors are not allowed to throw exceptions. No exceptions." }
|
{ $notes "Destructors are not allowed to throw exceptions. No exceptions." }
|
||||||
{ $examples
|
{ $examples
|
||||||
{ $code "[ 10 malloc free-always ] with-destructors" }
|
{ $code "[ 10 malloc free-always ] with-destructors" }
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ USING: alien alien.c-types arrays assocs combinators
|
||||||
continuations destructors io io.backend io.nonblocking
|
continuations destructors io io.backend io.nonblocking
|
||||||
io.windows libc kernel math namespaces sequences threads
|
io.windows libc kernel math namespaces sequences threads
|
||||||
tuples.lib windows windows.errors windows.kernel32 strings
|
tuples.lib windows windows.errors windows.kernel32 strings
|
||||||
splitting io.files windows.winsock ;
|
splitting io.files qualified ;
|
||||||
|
QUALIFIED: windows.winsock
|
||||||
IN: io.windows.nt.backend
|
IN: io.windows.nt.backend
|
||||||
|
|
||||||
: unicode-prefix ( -- seq )
|
: unicode-prefix ( -- seq )
|
||||||
|
|
@ -62,14 +63,16 @@ C: <io-callback> io-callback
|
||||||
: set-port-overlapped ( overlapped port -- )
|
: set-port-overlapped ( overlapped port -- )
|
||||||
port-handle set-win32-file-overlapped ;
|
port-handle set-win32-file-overlapped ;
|
||||||
|
|
||||||
: completion-port ( handle existing -- handle )
|
: <completion-port> ( handle existing -- handle )
|
||||||
f 1 CreateIoCompletionPort dup win32-error=0/f ;
|
f 1 CreateIoCompletionPort dup win32-error=0/f ;
|
||||||
|
|
||||||
: master-completion-port ( -- handle )
|
SYMBOL: master-completion-port
|
||||||
INVALID_HANDLE_VALUE f completion-port ;
|
|
||||||
|
: <master-completion-port> ( -- handle )
|
||||||
|
INVALID_HANDLE_VALUE f <completion-port> ;
|
||||||
|
|
||||||
M: windows-nt-io add-completion ( handle -- )
|
M: windows-nt-io add-completion ( handle -- )
|
||||||
\ master-completion-port get-global completion-port drop ;
|
master-completion-port get-global <completion-port> drop ;
|
||||||
|
|
||||||
TUPLE: GetOverlappedResult-args hFile* lpOverlapped* lpNumberOfBytesTransferred* bWait* port ;
|
TUPLE: GetOverlappedResult-args hFile* lpOverlapped* lpNumberOfBytesTransferred* bWait* port ;
|
||||||
|
|
||||||
|
|
@ -98,8 +101,8 @@ TUPLE: GetQueuedCompletionStatusParams hCompletionPort* lpNumberOfBytes* lpCompl
|
||||||
C: <GetQueuedCompletionStatusParams> GetQueuedCompletionStatusParams
|
C: <GetQueuedCompletionStatusParams> GetQueuedCompletionStatusParams
|
||||||
|
|
||||||
: wait-for-overlapped ( ms -- GetQueuedCompletionStatus-Params ret )
|
: wait-for-overlapped ( ms -- GetQueuedCompletionStatus-Params ret )
|
||||||
>r \ master-completion-port get-global 0 <int>
|
>r master-completion-port get-global 0 <int> 0 <int> 0 <int>
|
||||||
0 <int> 0 <int> r> <GetQueuedCompletionStatusParams> [
|
r> <GetQueuedCompletionStatusParams> [
|
||||||
GetQueuedCompletionStatusParams >tuple*<
|
GetQueuedCompletionStatusParams >tuple*<
|
||||||
GetQueuedCompletionStatus
|
GetQueuedCompletionStatus
|
||||||
] keep swap ;
|
] keep swap ;
|
||||||
|
|
@ -146,7 +149,7 @@ M: windows-nt-io init-io ( -- )
|
||||||
#! Should only be called on startup. Calling this at any
|
#! Should only be called on startup. Calling this at any
|
||||||
#! other time can have unintended consequences.
|
#! other time can have unintended consequences.
|
||||||
global [
|
global [
|
||||||
master-completion-port \ master-completion-port set
|
<master-completion-port> master-completion-port set
|
||||||
H{ } clone io-hash set
|
H{ } clone io-hash set
|
||||||
init-winsock
|
windows.winsock:init-winsock
|
||||||
] bind ;
|
] bind ;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue