United States-English |
|
|
HP-UX Reference > Ppthread_get_nice_np(3T)Pthread LibraryHP-UX 11i Version 3: February 2007 |
|
NAMEpthread_get_nice_np(), pthread_set_nice_np() — get or set the nice value of a thread SYNOPSIS#include <pthread.h> int pthread_get_nice_np( pthread_t thread, int *nice_val ); int pthread_set_nice_np( pthread_t thread, int nice_val ); PARAMETERS
DESCRIPTIONThese functions are used to set and retrieve the nice value of an individual thread. pthread_get_nice_np() returns the current nice value setting of the target thread and stores it in nice_val. pthread_set_nice_np() adds the value of nice_val to the current nice value of the target thread. A thread's nice value is a non-negative number. The system imposes a minimum nice value of 0 and a maximum of 39 with lower nice values providing more favorable scheduling. If calling pthread_set_nice_np() results in a nice value outside the range of 0 to 39, the value will be set to the nearest limit. A process must have appropriate privileges to lower a thread's nice value. The pthread_set_nice_np() function allows individual threads in the process to have different nice values. pthread_get_nice_np() returns the current nice value less 20 and will be in the range -20 to +19. The nice value of only system scope (PTHREAD_SCOPE_SYSTEM) threads can be changed. An attempt to change the nice value of a process-scope thread will result in a return value of ENOTSUP. Calling pthread_set_nice_np() on a thread that has a scheduling policy other than SCHED_HPUX will have an effect only when the thread's scheduling policy changes to SCHED_HPUX. If a thread calls the fork() system call to create a new process, the new process inherits the process-level nice value. Calling pthread_create() to create a new thread will result in the new thread inheriting the creating thread's nice value. NoteIf the nice value of the entire process is changed through nice() or setpriority(), all the threads in the process will have their nice values reset to the new process-level nice value. The new process's nice value setting overwrites the old thread's setting. Thus its possible that a thread whose nice value had been set higher than the process-level nice value have its nice value lowered as a result of the process-level re-nicing. RETURN VALUEUpon successful completion, pthread_set_nice_np() and pthread_get_nice_np() return zero. Otherwise, an error number is returned to indicate the error (the errno variable is not set). ERRORSIf any of the following occur, the pthread_get_nice_np() and pthread_set_nice_np() functions return the corresponding error:
|
Printable version | ||
|