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
|
C: <io-callback> io-callback
|
||||||
|
|
||||||
: (make-overlapped) ( -- overlapped-ext )
|
: (make-overlapped) ( -- overlapped-ext )
|
||||||
"OVERLAPPED" malloc-object dup free-always
|
"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 ;
|
|
||||||
|
|
||||||
: make-overlapped ( port -- overlapped-ext )
|
: make-overlapped ( port -- overlapped-ext )
|
||||||
>r (make-overlapped) r> port-handle win32-file-ptr
|
>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 ;
|
M: windows-nt-io close-monitor ( monitor -- ) stream-close ;
|
||||||
|
|
||||||
: begin-reading-changes ( monitor -- overlapped )
|
: begin-reading-changes ( monitor -- overlapped )
|
||||||
[
|
dup port-handle win32-file-handle
|
||||||
dup port-handle win32-file-handle
|
over buffer-ptr
|
||||||
over buffer-ptr
|
pick buffer-size
|
||||||
pick buffer-size
|
roll monitor-recursive? 1 0 ?
|
||||||
roll monitor-recursive? 1 0 ?
|
FILE_NOTIFY_CHANGE_ALL
|
||||||
FILE_NOTIFY_CHANGE_ALL
|
0 <uint>
|
||||||
0 <uint>
|
(make-overlapped)
|
||||||
f
|
[ f ReadDirectoryChangesW win32-error=0/f ] keep ;
|
||||||
(make-overlapped)
|
|
||||||
[ ReadDirectoryChangesW win32-error=0/f ] keep
|
|
||||||
] with-destructors ;
|
|
||||||
|
|
||||||
: read-changes ( monitor -- bytes )
|
: 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 )
|
: parse-action-flag ( action mask symbol -- action )
|
||||||
>r over bitand 0 > [ r> , ] [ r> drop ] if ;
|
>r over bitand 0 > [ r> , ] [ r> drop ] if ;
|
||||||
|
|
Loading…
Reference in New Issue