Non-blocking directory change notification support for Windows
parent
417e475857
commit
19555da91c
|
@ -48,12 +48,7 @@ TUPLE: io-callback port continuation ;
|
|||
C: <io-callback> io-callback
|
||||
|
||||
: (make-overlapped) ( -- overlapped-ext )
|
||||
"OVERLAPPED" malloc-object dup free-always
|
||||
0 over set-OVERLAPPED-internal
|
||||
0 over set-OVERLAPPED-internal-high
|
||||
0 over set-OVERLAPPED-offset-high
|
||||
0 over set-OVERLAPPED-offset
|
||||
f over set-OVERLAPPED-event ;
|
||||
"OVERLAPPED" malloc-object dup free-always ;
|
||||
|
||||
: make-overlapped ( port -- overlapped-ext )
|
||||
>r (make-overlapped) r> port-handle win32-file-ptr
|
||||
|
|
|
@ -37,21 +37,20 @@ M: windows-nt-io <monitor> ( path recursive? -- monitor )
|
|||
M: windows-nt-io close-monitor ( monitor -- ) stream-close ;
|
||||
|
||||
: begin-reading-changes ( monitor -- overlapped )
|
||||
[
|
||||
dup port-handle win32-file-handle
|
||||
over buffer-ptr
|
||||
pick buffer-size
|
||||
roll monitor-recursive? 1 0 ?
|
||||
FILE_NOTIFY_CHANGE_ALL
|
||||
0 <uint>
|
||||
f
|
||||
(make-overlapped)
|
||||
[ ReadDirectoryChangesW win32-error=0/f ] keep
|
||||
] with-destructors ;
|
||||
dup port-handle win32-file-handle
|
||||
over buffer-ptr
|
||||
pick buffer-size
|
||||
roll monitor-recursive? 1 0 ?
|
||||
FILE_NOTIFY_CHANGE_ALL
|
||||
0 <uint>
|
||||
(make-overlapped)
|
||||
[ f ReadDirectoryChangesW win32-error=0/f ] keep ;
|
||||
|
||||
: read-changes ( monitor -- bytes )
|
||||
dup begin-reading-changes swap [ save-callback ] 2keep
|
||||
get-overlapped-result ;
|
||||
[
|
||||
dup begin-reading-changes swap [ save-callback ] 2keep
|
||||
get-overlapped-result
|
||||
] with-destructors ;
|
||||
|
||||
: parse-action-flag ( action mask symbol -- action )
|
||||
>r over bitand 0 > [ r> , ] [ r> drop ] if ;
|
||||
|
|
Loading…
Reference in New Issue