]> gitweb.factorcode.org Git - factor.git/blob - basis/io/monitors/macosx/macosx.factor
Merge branch 'master' into experimental
[factor.git] / basis / io / monitors / macosx / macosx.factor
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.monitors.macosx
7
8 TUPLE: macosx-monitor < monitor handle ;
9
10 : enqueue-notifications ( triples monitor -- )
11     '[ first { +modify-file+ } _ queue-change ] each ;
12
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
18     ] ;
19
20 M: macosx-monitor dispose
21     handle>> dispose ;
22
23 macosx set-io-backend