factor/extra/io/unix/bsd/bsd.factor

28 lines
833 B
Factor
Raw Normal View History

! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
IN: io.unix.bsd
USING: io.backend io.unix.backend io.unix.kqueue io.unix.select
2008-01-24 23:41:55 -05:00
io.launcher io.unix.launcher namespaces kernel assocs threads
continuations ;
2008-02-12 03:21:47 -05:00
! On Mac OS X, we use select() for the top-level
! multiplexer, and we hang a kqueue off of it for process exit
! notification.
! kqueue is buggy with files and ptys so we can't use it as the
! main multiplexer.
2008-02-12 03:21:47 -05:00
MIXIN: bsd-io
INSTANCE: bsd-io unix-io
M: bsd-io init-io ( -- )
<select-mx> mx set-global
<kqueue-mx> kqueue-mx set-global
kqueue-mx get-global <mx-port> <mx-task> dup io-task-fd
2dup mx get-global mx-reads set-at
mx get-global mx-writes set-at ;
M: bsd-io register-process ( process -- )
process-handle kqueue-mx get-global add-pid-task ;