[MacRuby-devel] [MacRuby] #479: Need GCD wrapper for Process Sources
MacRuby
ruby-noreply at macosforge.org
Wed Dec 2 18:19:04 PST 2009
#479: Need GCD wrapper for Process Sources
----------------------------------------+-----------------------------------
Reporter: ernest.prabhakar@… | Owner: lsansonetti@…
Type: defect | Status: new
Priority: blocker | Milestone: MacRuby 0.5
Component: MacRuby | Keywords:
----------------------------------------+-----------------------------------
We should wrap DISPATCH_SOURCE_TYPE_PROC
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dispatch_source_create.3.html
proc_src = Dispatch::Source.for_process(queue, Process::Status, mask,
&block)
I think the only tricky part is defining a good set of constants for the
mask:
DISPATCH_PROC_EXIT The process has exited and is available
to wait(2).
DISPATCH_PROC_FORK The process has created one or more
child processes.
DISPATCH_PROC_EXEC The process has become another
executable image via a call to execve(2)
or posix_spawn(2).
DISPATCH_PROC_REAP The process status has been collected by
its parent process via wait(2).
DISPATCH_PROC_SIGNAL A signal was delivered to the process.
So they can be easily extracted from the data passed to the handler:
The data returned by dispatch_source_get_data() indicates which of
the events in the mask were observed.
For example, it may be worthwhile to create a
Dispatch::Source::ProcessEvent class which is passed both as the original
mask and as the data returned to the handler.
--
Ticket URL: <http://www.macruby.org/trac/ticket/479>
MacRuby <http://macruby.org/>
More information about the MacRuby-devel
mailing list