Update Mac OS X monitors for new API
parent
0c7e742b8c
commit
82d793b141
|
@ -151,12 +151,10 @@ SYMBOL: event-stream-callbacks
|
||||||
|
|
||||||
[
|
[
|
||||||
event-stream-callbacks global
|
event-stream-callbacks global
|
||||||
[ [ drop expired? not ] assoc-subset ] change-at
|
[ [ drop expired? not ] assoc-subset H{ } assoc-like ] change-at
|
||||||
1 \ event-stream-counter set-global
|
1 \ event-stream-counter set-global
|
||||||
] "core-foundation" add-init-hook
|
] "core-foundation" add-init-hook
|
||||||
|
|
||||||
event-stream-callbacks global [ H{ } assoc-like ] change-at
|
|
||||||
|
|
||||||
: add-event-source-callback ( quot -- id )
|
: add-event-source-callback ( quot -- id )
|
||||||
event-stream-counter <alien>
|
event-stream-counter <alien>
|
||||||
[ event-stream-callbacks get set-at ] keep ;
|
[ event-stream-callbacks get set-at ] keep ;
|
||||||
|
|
|
@ -29,7 +29,8 @@ M: monitor set-timeout (>>timeout) ;
|
||||||
swap >>path ; inline
|
swap >>path ; inline
|
||||||
|
|
||||||
: queue-change ( path changes monitor -- )
|
: queue-change ( path changes monitor -- )
|
||||||
dup [ [ 3array ] keep queue>> mailbox-put ] [ 3drop ] if ;
|
3dup and and
|
||||||
|
[ [ 3array ] keep queue>> mailbox-put ] [ 3drop ] if ;
|
||||||
|
|
||||||
HOOK: (monitor) io-backend ( path recursive? mailbox -- monitor )
|
HOOK: (monitor) io-backend ( path recursive? mailbox -- monitor )
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
! Copyright (C) 2008 Slava Pestov.
|
! Copyright (C) 2008 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: io.unix.bsd io.backend io.monitors core-foundation.fsevents
|
USING: io.unix.bsd io.backend io.monitors core-foundation.fsevents
|
||||||
continuations kernel sequences namespaces arrays system locals ;
|
continuations kernel sequences namespaces arrays system locals
|
||||||
|
accessors ;
|
||||||
IN: io.unix.macosx
|
IN: io.unix.macosx
|
||||||
|
|
||||||
macosx set-io-backend
|
|
||||||
|
|
||||||
TUPLE: macosx-monitor < monitor handle ;
|
TUPLE: macosx-monitor < monitor handle ;
|
||||||
|
|
||||||
: enqueue-notifications ( triples monitor -- )
|
: enqueue-notifications ( triples monitor -- )
|
||||||
tuck monitor-queue
|
[
|
||||||
[ [ first { +modify-file+ } swap changed-file ] each ] bind
|
>r first { +modify-file+ } r> queue-change
|
||||||
notify-callback ;
|
] curry each ;
|
||||||
|
|
||||||
|
M: macosx init-monitors ;
|
||||||
|
|
||||||
|
M: macosx dispose-monitors ;
|
||||||
|
|
||||||
M:: macosx (monitor) ( path recursive? mailbox -- monitor )
|
M:: macosx (monitor) ( path recursive? mailbox -- monitor )
|
||||||
path mailbox macosx-monitor construct-monitor
|
path mailbox macosx-monitor construct-monitor
|
||||||
|
@ -20,3 +23,5 @@ M:: macosx (monitor) ( path recursive? mailbox -- monitor )
|
||||||
|
|
||||||
M: macosx-monitor dispose
|
M: macosx-monitor dispose
|
||||||
handle>> dispose ;
|
handle>> dispose ;
|
||||||
|
|
||||||
|
macosx set-io-backend
|
||||||
|
|
Loading…
Reference in New Issue