Method: Process#getpriority

Defined in:
process.c

#getpriority(kind, id) ⇒ Integer (private)

Returns the scheduling priority for specified process, process group, or user.

Argument kind is one of:

  • Process::PRIO_PROCESS: return priority for process.

  • Process::PRIO_PGRP: return priority for process group.

  • Process::PRIO_USER: return priority for user.

Argument id is the ID for the process, process group, or user; zero specified the current ID for kind.

Examples:

Process.getpriority(Process::PRIO_USER, 0)    # => 19
Process.getpriority(Process::PRIO_PROCESS, 0) # => 19

Not available on all platforms.

Returns:



5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
# File 'process.c', line 5310

static VALUE
proc_getpriority(VALUE obj, VALUE which, VALUE who)
{
    int prio, iwhich, iwho;

    iwhich = NUM2INT(which);
    iwho   = NUM2INT(who);

    errno = 0;
    prio = getpriority(iwhich, iwho);
    if (errno) rb_sys_fail(0);
    return INT2FIX(prio);
}