Merged Thomas' comments.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* \file message_queue.c
|
||||
* \brief A message queue used to exchange messages between two concurrent threads.
|
||||
* \author Thomas Stegemann
|
||||
* \version $Id: message_queue.c,v 1.1 2006/09/26 18:18:27 rschaten Exp $
|
||||
* \version $Id: message_queue.c,v 1.2 2006/09/29 22:30:03 rschaten Exp $
|
||||
*
|
||||
* License: See documentation.
|
||||
*/
|
||||
@ -13,22 +13,23 @@
|
||||
|
||||
/** Structure of the global data of the queue */
|
||||
typedef struct S_messageQueue_GlobalData {
|
||||
messageQueue_QueuedMessage queue[messageQueue_Size]; /**< the queue itself */
|
||||
messageQueue_QueuedMessage queue[messageQueue_Size]; /**< the data elements of the queue */
|
||||
messageQueue_SizeType begin; /**< the current start of the queue */
|
||||
messageQueue_SizeType end; /**< the current end of the queue */
|
||||
messageQueue_SizeType end; /**< the current end of the queue, behind the last element */
|
||||
} messageQueue_GlobalData;
|
||||
|
||||
/** Global data of the queue */
|
||||
static volatile messageQueue_GlobalData m_data;
|
||||
|
||||
/**
|
||||
* Get the next entry fron the queue.
|
||||
* \param value Number of the current entry.
|
||||
* \return 0 if the value is larger than the queue, otherwise the next entry.
|
||||
* increments an messageQueue index
|
||||
* \param value position within the messageQueue
|
||||
* \return the following position within the messageQueue
|
||||
*/
|
||||
static inline messageQueue_SizeType messageQueue_next(messageQueue_SizeType value) {
|
||||
value++;
|
||||
if(value >= messageQueue_Size) {
|
||||
/* messageQueue is used circular */
|
||||
value= 0;
|
||||
}
|
||||
return value;
|
||||
@ -57,8 +58,7 @@ Boolean messageQueue_isEmpty(void) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the queue is full. If it is full, new entries will overwrite the
|
||||
* first entries.
|
||||
* Test if the queue is full.
|
||||
* \return True if it is full, otherwise false.
|
||||
*/
|
||||
Boolean messageQueue_isFull(void) {
|
||||
|
Reference in New Issue
Block a user