diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-09-17 10:37:54 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-09-17 10:37:54 +0000 |
commit | 227f9b7e3e3ad570adccec22df0e2da29080b4e9 (patch) | |
tree | 1215e6f68b94faa2366687d7b15d8e15700fa95a /os/rt/include | |
parent | 7fa620e9fb996b0763554dec4ec91aa299e36e38 (diff) | |
download | ChibiOS-227f9b7e3e3ad570adccec22df0e2da29080b4e9.tar.gz ChibiOS-227f9b7e3e3ad570adccec22df0e2da29080b4e9.tar.bz2 ChibiOS-227f9b7e3e3ad570adccec22df0e2da29080b4e9.zip |
Added new chThdDoDequeueNextI() API.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7286 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/include')
-rw-r--r-- | os/rt/include/chthreads.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h index ca2d3bcbc..fa093b09c 100644 --- a/os/rt/include/chthreads.h +++ b/os/rt/include/chthreads.h @@ -393,6 +393,31 @@ static inline bool chThdQueueIsEmptyI(threads_queue_t *tqp) { return queue_isempty(tqp);
}
+
+/**
+ * @brief Dequeues and wakes up one thread from the threads queue object.
+ * @details Dequeues one thread from the queue without checking if the queue
+ * is empty.
+ * @pre The queue must contain at least an object.
+ *
+ * @param[in] tqp pointer to the threads queue object
+ * @param[in] msg the message code
+ *
+ * @iclass
+ */
+static inline void chThdDoDequeueNextI(threads_queue_t *tqp, msg_t msg) {
+ thread_t *tp;
+
+ chDbgAssert(queue_notempty(tqp), "empty queue");
+
+ tp = queue_fifo_remove(tqp);
+
+ chDbgAssert(tp->p_state == CH_STATE_QUEUED, "invalid state");
+
+ tp->p_u.rdymsg = msg;
+ chSchReadyI(tp);
+}
+
#endif /* _CHTHREADS_H_ */
/** @} */
|