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

28 lines
692 B
Factor
Raw Normal View History

2008-02-12 03:21:47 -05:00
IN: io.unix.macosx
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
namespaces arrays ;
2008-02-12 03:21:47 -05:00
TUPLE: macosx-io ;
INSTANCE: macosx-io bsd-io
T{ macosx-io } set-io-backend
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
M: macosx-io <monitor>
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 ;