# SetItemPri

Changes the priority of an item.

### Synopsis

`int32 SetItemPri( Item i, uint8 newpri )`

### Description

This procedure changes the priority of an item. Some items in the operating system are maintained in lists; for example, tasks and threads. Some lists are ordered by priority, with higher-priority items coming before lower-priority items. When the priority of an item in a list changes, the kernel automatically rearranges the list of items to reflect the new priority. The item is moved immediately before the first item whose priority is lower.

A task must own an item to change its priority. A task can change its own priority even if it does not own itself.

### Arguments

i
  The item number of the item whose priority to change.

newpri
  The new priority for the item.

### Return Value

The procedure returns the previous priority of the item or an error code if an error occurs.

### Implementation

SWI implemented in kernel folio V20.

### Associated Files

item.h
  ANSI C Prototype

### Notes

For certain item types, such as devices, the kernel may change the priority of an item to help optimize throughput.

### Caveats

This function is not implemented for all known item types.

### See Also

``CreateItem`()`

#