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
2644 2644

  
2645 2645
/*
2646 2646
 *  call-seq:
2647
 *     Process.fork_supported?   # => boolean
2648
 *
2649
 *  Returns whether forking subprocesses is supported on the current platform.
2650
 *  If not, then it indicates that <code>Kernel.fork</code> and
2651
 *  <code>Process.fork</code> will raise NotImplementedError.
2652
 */
2653

  
2654
static VALUE
2655
rb_f_fork_supported_p(VALUE obj)
2656
{
2657
#if defined(HAVE_FORK) && !defined(CANNOT_FORK_WITH_PTHREAD)
2658
    return Qtrue;
2659
#else
2660
    return Qfalse;
2661
#endif
2662
}
2663

  
2664
/*
2665
 *  call-seq:
2647 2666
 *     Process.exit!(fixnum=-1)
2648 2667
 *
2649 2668
 *  Exits the process immediately. No exit handlers are
......
5428 5447

  
5429 5448
    rb_define_singleton_method(rb_mProcess, "exec", rb_f_exec, -1);
5430 5449
    rb_define_singleton_method(rb_mProcess, "fork", rb_f_fork, 0);
5450
    rb_define_singleton_method(rb_mProcess, "fork_supported?", rb_f_fork_supported_p, 0);
5431 5451
    rb_define_singleton_method(rb_mProcess, "spawn", rb_f_spawn, -1);
5432 5452
    rb_define_singleton_method(rb_mProcess, "exit!", rb_f_exit_bang, -1);
5433 5453
    rb_define_singleton_method(rb_mProcess, "exit", rb_f_exit, -1);
5434
-