+
+#if CONFIG_KERN_PRI
+/**
+ * Change the scheduling priority of a process.
+ *
+ * Process piorities are signed ints, whereas a larger integer value means
+ * higher scheduling priority. The default priority for new processes is 0.
+ * The idle process runs with the lowest possible priority: INT_MIN.
+ *
+ * A process with a higher priority always preempts lower priority processes.
+ * Processes of equal priority share the CPU time according to a simple
+ * round-robin policy.
+ *
+ * As a general rule to maximize responsiveness, compute-bound processes
+ * should be assigned negative priorities and tight, interactive processes
+ * should be assigned positive priorities.
+ *
+ * To avoid interfering with system background activities such as input
+ * processing, application processes should remain within the range -10
+ * and +10.
+ */
+void proc_setPri(struct Process *proc, int pri)
+{
+ if (proc->link.pri == pri)
+ return;
+
+ proc->link.pri = pri;
+
+ if (proc != CurrentProcess)
+ {
+ proc_forbid();
+ ATOMIC(sched_reenqueue(proc));
+ proc_permit();
+ }
+}
+#endif // CONFIG_KERN_PRI
+