From 3b9ae6825f753e21f2db109d7b1005a6acfe475c Mon Sep 17 00:00:00 2001 From: gdisirio Date: Wed, 10 Sep 2014 12:35:59 +0000 Subject: Added function chThdQueueIsEmptyI(), fixed a naming error in threads queues static initializer. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7255 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/include/chcond.h | 2 +- os/rt/include/chmtx.h | 4 ++-- os/rt/include/chqueues.h | 4 ++-- os/rt/include/chsem.h | 2 +- os/rt/include/chthreads.h | 17 +++++++++++++++++ 5 files changed, 23 insertions(+), 6 deletions(-) (limited to 'os') diff --git a/os/rt/include/chcond.h b/os/rt/include/chcond.h index 94be40c74..80c3651c7 100644 --- a/os/rt/include/chcond.h +++ b/os/rt/include/chcond.h @@ -73,7 +73,7 @@ typedef struct condition_variable { * * @param[in] name the name of the condition variable */ -#define _CONDVAR_DATA(name) {_threads_queue_t_DATA(name.c_queue)} +#define _CONDVAR_DATA(name) {_THREADS_QUEUE_DATA(name.c_queue)} /** * @brief Static condition variable initializer. diff --git a/os/rt/include/chmtx.h b/os/rt/include/chmtx.h index 097b349c5..ecfffae92 100644 --- a/os/rt/include/chmtx.h +++ b/os/rt/include/chmtx.h @@ -79,9 +79,9 @@ struct mutex { * @param[in] name the name of the mutex variable */ #if CH_CFG_USE_MUTEXES_RECURSIVE || defined(__DOXYGEN__) -#define _MUTEX_DATA(name) {_threads_queue_t_DATA(name.m_queue), NULL, NULL, 0} +#define _MUTEX_DATA(name) {_THREADS_QUEUE_DATA(name.m_queue), NULL, NULL, 0} #else -#define _MUTEX_DATA(name) {_threads_queue_t_DATA(name.m_queue), NULL, NULL} +#define _MUTEX_DATA(name) {_THREADS_QUEUE_DATA(name.m_queue), NULL, NULL} #endif /** diff --git a/os/rt/include/chqueues.h b/os/rt/include/chqueues.h index 63d91c090..c86a68fea 100644 --- a/os/rt/include/chqueues.h +++ b/os/rt/include/chqueues.h @@ -129,7 +129,7 @@ typedef io_queue_t output_queue_t; * @param[in] link application defined pointer */ #define _INPUTQUEUE_DATA(name, buffer, size, inotify, link) { \ - _threads_queue_t_DATA(name), \ + _THREADS_QUEUE_DATA(name), \ 0, \ (uint8_t *)(buffer), \ (uint8_t *)(buffer) + (size), \ @@ -165,7 +165,7 @@ typedef io_queue_t output_queue_t; * @param[in] link application defined pointer */ #define _OUTPUTQUEUE_DATA(name, buffer, size, onotify, link) { \ - _threads_queue_t_DATA(name), \ + _THREADS_QUEUE_DATA(name), \ (size), \ (uint8_t *)(buffer), \ (uint8_t *)(buffer) + (size), \ diff --git a/os/rt/include/chsem.h b/os/rt/include/chsem.h index badebc3f9..4762da9df 100644 --- a/os/rt/include/chsem.h +++ b/os/rt/include/chsem.h @@ -69,7 +69,7 @@ typedef struct semaphore { * @param[in] n the counter initial value, this value must be * non-negative */ -#define _SEMAPHORE_DATA(name, n) {_threads_queue_t_DATA(name.s_queue), n} +#define _SEMAPHORE_DATA(name, n) {_THREADS_QUEUE_DATA(name.s_queue), n} /** * @brief Static semaphore initializer. diff --git a/os/rt/include/chthreads.h b/os/rt/include/chthreads.h index 03ac3fba7..ca2d3bcbc 100644 --- a/os/rt/include/chthreads.h +++ b/os/rt/include/chthreads.h @@ -376,6 +376,23 @@ static inline void chThdQueueObjectInit(threads_queue_t *tqp) { queue_init(tqp); } +/** + * @brief Evaluates to @p true if the specified queue is empty. + * + * @param[out] tqp pointer to the threads queue object + * @return The queue status. + * @retval false if the queue is not empty. + * @retval true if the queue is empty. + * + * @iclass + */ +static inline bool chThdQueueIsEmptyI(threads_queue_t *tqp) { + + chDbgCheckClassI(); + + return queue_isempty(tqp); +} + #endif /* _CHTHREADS_H_ */ /** @} */ -- cgit v1.2.3