1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: io.backend io.monitors
4 core-foundation.fsevents continuations kernel sequences
5 namespaces arrays system locals accessors destructors fry ;
6 IN: io.unix.macosx.monitors
8 TUPLE: macosx-monitor < monitor handle ;
10 : enqueue-notifications ( triples monitor -- )
11 '[ first { +modify-file+ } _ queue-change ] each ;
13 M:: macosx (monitor) ( path recursive? mailbox -- monitor )
14 [let | path [ path normalize-path ] |
15 path mailbox macosx-monitor new-monitor
16 dup [ enqueue-notifications ] curry
17 path 1array 0 0 <event-stream> >>handle
20 M: macosx-monitor dispose