Module posix.sched

Kernel Thread Scheduling Priority.

Where supported by the underlying system, functions to discover and change the kernel thread scheduling priority. If the module loads successfully, but there is no kernel support, then posix.sched.version will be set, but the unsupported APIs will be nil.

Functions

sched_getscheduler ([pid=0]) get scheduling policy
sched_setscheduler ([pid=0[, policy=`SCHED_OTHER`[, priority=0]]]) set scheduling policy/priority

Constants

posix.sched Scheduler constants.


Functions

sched_getscheduler ([pid=0])
get scheduling policy

Parameters:

  • pid int process to act on, or 0 for caller process (default 0)

Returns:

    int scheduling policy SCHED_FIFO, SCHED_RR, SCHED_OTHER, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

sched_setscheduler ([pid=0[, policy=`SCHED_OTHER`[, priority=0]]])
set scheduling policy/priority

Parameters:

  • pid int process to act on, or 0 for caller process (default 0)
  • policy int one of SCHED_FIFO, SCHED_RR or SCHED_OTHER (default `SCHED_OTHER`)
  • priority int must be 0 for SCHED_OTHER, or else a positive number below 100 for real-time policies (default 0)

Returns:

    int 0, if successful

Or

  1. nil
  2. string error message
  3. int errnum

See also:

Constants

posix.sched
Scheduler constants. Any constants not available in the underlying system will be nil valued.

Fields:

  • SCHED_FIFO int first-in, first-out scheduling policy
  • SCHED_RR int round-robin scheduling policy
  • SCHED_OTHER int another scheduling policy

Usage:

      -- Print scheduler constants supported on this host.
      for name, value in pairs (require "posix.sched") do
        if type (value) == "number" then
          print (name, value)
         end
      end
generated by LDoc 1.4.3 Last updated 2015-03-01 09:06:02