USB-LED-Fader/firmware/message_queue.h

38 lines
1.4 KiB
C
Raw Permalink Normal View History

2006-09-26 20:18:27 +02:00
#ifndef message_queue_h
#define message_queue_h
/**
* \file message_queue.h
* \brief A message queue used to exchange messages between two concurrent
* threads.
* \author Thomas Stegemann
* \version $Id: message_queue.h,v 1.1 2006/09/26 18:18:27 rschaten Exp $
*
* License: See documentation.
*
* - exchange messages between two concurrent threads (e.g.: main thread and
* interrupt calls)
* - before using any other function of the messageQueue, init must be called
* - one thread must be data source (use isFull and write)
* - the other thread must be the data sink (use isEmpty and read)
* - two concurrent threads must not use both the write functions and two
* concurrent threads must not use both the read functions
* - read/write return True on success and False if the message could not be
* read/written because the queue is empty/full
* - the size of the messageQueue and the type of the
* messageQueue_QueuedMessage are defined in config_message_queue.h
* - only one messageQueue can be used in a project
*/
#include "boolean.h"
#include "config_message_queue.h"
void messageQueue_init (void);
void messageQueue_cleanup(void);
Boolean messageQueue_isEmpty(void);
Boolean messageQueue_isFull (void);
Boolean messageQueue_read (messageQueue_QueuedMessage* pMessage);
Boolean messageQueue_write (messageQueue_QueuedMessage message);
#endif