Project

General

Profile

Feature #2619 » 0001-Add-method-Process.fork_supported-for-checking-wheth.patch

hongli (Hongli Lai), 01/21/2010 12:35 AM

View differences:

process.c
/*
* call-seq:
* Process.fork_supported? # => boolean
*
* Returns whether forking subprocesses is supported on the current platform.
* If not, then it indicates that <code>Kernel.fork</code> and
* <code>Process.fork</code> will raise NotImplementedError.
*/
static VALUE
rb_f_fork_supported_p(VALUE obj)
{
#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
return Qtrue;
#else
return Qfalse;
#endif
}
/*
* call-seq:
* Process.exit!(fixnum=-1)
*
* Exits the process immediately. No exit handlers are
......
rb_define_singleton_method(rb_mProcess, "exec", rb_f_exec, -1);
rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0);
rb_define_singleton_method(rb_mProcess, "fork_supported?", rb_f_fork_supported_p, 0);
rb_define_singleton_method(rb_mProcess, "spawn", rb_f_spawn, -1);
rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1);
rb_define_singleton_method(rb_mProcess, "exit", rb_f_exit, -1);
(2-2/2)