diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-06 09:53:07 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2007-10-06 09:53:07 +0000 |
commit | 00c6f5ea40f97385dce7ab7b9d20bc0cb909ad23 (patch) | |
tree | 4f6800f72e8ef9efbf6c2c57214738eda773a1ae /src/chthreads.c | |
parent | d6d799ed48f8193bee286187132221f831726a07 (diff) | |
download | ChibiOS-00c6f5ea40f97385dce7ab7b9d20bc0cb909ad23.tar.gz ChibiOS-00c6f5ea40f97385dce7ab7b9d20bc0cb909ad23.tar.bz2 ChibiOS-00c6f5ea40f97385dce7ab7b9d20bc0cb909ad23.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@40 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/chthreads.c')
-rw-r--r-- | src/chthreads.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/chthreads.c b/src/chthreads.c index 608dabe89..28b276db5 100644 --- a/src/chthreads.c +++ b/src/chthreads.c @@ -100,6 +100,27 @@ Thread *chThdCreate(t_prio prio, t_tmode mode, void *workspace, return tp;
}
+/**
+ * Changes the thread priority, reschedules if necessary.
+ * @param newprio the new priority of the invoking thread
+ */
+void chThdSetPriority(t_prio newprio) {
+
+ chSysLock();
+
+#ifdef CH_USE_RT_SEMAPHORES
+ if (currp->p_rtcnt)
+ currp->p_prio = newprio + MEPRIO;
+ else
+ currp->p_prio = newprio;
+#else
+ currp->p_prio = newprio;
+#endif
+ chSchRescheduleI();
+
+ chSysUnlock();
+}
+
#ifdef CH_USE_RESUME
/**
* Resumes a thread created with the \p P_SUSPENDED option.
|