module Process
Public Class Methods
getitimer → [interval, value]
click to toggle source
Returns the interval and the remaining seconds to next alarm.
VALUE rb_process_getitimer( VALUE obj) { struct itimerval it; VALUE r; if (getitimer( ITIMER_REAL, &it) < 0) rb_raise( rb_eSystemCallError, "getitimer failed."); r = rb_ary_new3( 2, suppelement_timeval_sec( &it.it_interval), suppelement_timeval_sec( &it.it_value)); return r; }
renice( pid = nil, priority) → nil
click to toggle source
Set a new nice value. If pid is nil
, renice the current
process.
VALUE rb_process_renice( int argc, VALUE *argv, VALUE obj) { VALUE p1, p2; pid_t pid; int prio; if (rb_scan_args( argc, argv, "11", &p1, &p2) == 1) pid = getpid(), prio = NUM2INT( p1); else pid = NUM2INT( p1), prio = NUM2INT( p2); rb_secure(2); if (setpriority( PRIO_PROCESS, pid, prio) < 0) rb_sys_fail(0); return Qnil; }
setitimer( interval = nil, value = nil) → nil
click to toggle source
Set alarm timer. If value
is nonzero, it is the expiration
time to the first alarm. If it is zero, the timer is disabled. If
value
is nonzero and interval
is zero, the alarm
is triggered once.
VALUE rb_process_setitimer( int argc, VALUE *argv, VALUE obj) { VALUE isec; VALUE vsec; struct itimerval it; rb_scan_args( argc, argv, "02", &isec, &vsec); suppelement_sec_timeval( isec, &it.it_interval); if (NIL_P(vsec) && !NIL_P(isec)) it.it_value = it.it_interval; else suppelement_sec_timeval( vsec, &it.it_value); if (setitimer( ITIMER_REAL, &it, NULL) < 0) rb_raise( rb_eSystemCallError, "setitimer failed."); return Qnil; }
sync → nil
click to toggle source
Force completion of pending disk writes (flush cache). See sync(8).
VALUE rb_process_sync( VALUE obj) { sync(); return Qnil; }