module Process
def setpriority(kind, int, int_priority)
* Process::ABOVE_NORMAL_PRIORITY_CLASS
* Process::BELOW_NORMAL_PRIORITY_CLASS
* Process::REALTIME_PRIORITY_CLASS
* Process::HIGH_PRIORITY_CLASS
* Process::IDLE_PRIORITY_CLASS
* Process::NORMAL_PRIORITY_CLASS
Possible +int_priority+ values are:
information, so it is effectively always Process::PRIO_PROCESS.
You can only retrieve process information, not process group or user
The +kind+ parameter is ignored but present for API compatibility.
Sets the priority class for the specified process id +int+.
def setpriority(kind, int, int_priority) raise TypeError unless kind.is_a?(Integer) # Match spec raise TypeError unless int.is_a?(Integer) # Match spec raise TypeError unless int_priority.is_a?(Integer) # Match spec int = Process.pid if int == 0 # Match spec handle = OpenProcess(PROCESS_SET_INFORMATION, 0 , int) if handle == 0 raise SystemCallError, FFI.errno, "OpenProcess" end begin unless SetPriorityClass(handle, int_priority) raise SystemCallError, FFI.errno, "SetPriorityClass" end ensure CloseHandle(handle) end 0 # Match the spec end