factor/extra/io/unix/macosx/macosx.factor

24 lines
640 B
Factor
Raw Normal View History

2008-04-05 06:50:39 -04:00
USING: io.unix.bsd io.backend io.monitors io.monitors.private
2008-02-12 03:33:06 -05:00
continuations kernel core-foundation.fsevents sequences
2008-04-02 21:09:56 -04:00
namespaces arrays system ;
IN: io.unix.macosx
2008-02-12 03:21:47 -05:00
2008-04-02 21:09:56 -04:00
macosx set-io-backend
2008-02-12 03:21:47 -05:00
TUPLE: macosx-monitor ;
: enqueue-notifications ( triples monitor -- )
2008-02-12 13:19:25 -05:00
tuck monitor-queue
[ [ first { +modify-file+ } swap changed-file ] each ] bind
notify-callback ;
2008-02-12 03:21:47 -05:00
2008-04-02 21:09:56 -04:00
M: macosx <monitor>
2008-02-12 03:21:47 -05:00
drop
f macosx-monitor construct-simple-monitor
dup [ enqueue-notifications ] curry
rot 1array 0 0 <event-stream>
over set-simple-monitor-handle ;
M: macosx-monitor dispose
dup simple-monitor-handle dispose delegate dispose ;