Home  Contents

os.nice

OS Core4 Lua Commands

SYNOPSIS

#include <lua/signal.lh>
os.nice([delta])

DESCRIPTION

Change current process priority by adding delta to the current priority. (A higher nice value means a lower priority.)

The range of the resulting priority is +19 (low priority) to -20 (high priority).

To read current nice value, pass 0 or no value at all.

A spawned process inherits the parent's nice value at the time of spawning. Afterwards, the nice values are handled separately.

CAVEATS

Core4 has a simple scheduler. The lowest nice value that wants to run wins. Setting nice too low can prevent important kernel tasks from running.

RETURN VALUE

On success, returns current process nice value. On error, three values are returned: nil, a string describing the error (The result of the C library call strerror() on the errno code) and the errno number from the standard C library.