Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

event.c File Reference


Detailed Description

Event management routines.

This kernel module provides thread synchronization.

 *
 * $Log: event.c,v $
 * Revision 1.24  2006/06/28 14:38:34  haraldkipp
 * Event and timer handling re-design, again. This fixes a bug, which
 * possibly existed since version 3.9.8 and freezes threads under heavy
 * load. After several people reported this problem, Michael Jones and
 * Henrik Maier finally detected the cause and came up with a solution.
 * However, this fix let interrupt latency times depend on the number
 * of running threads again and a new solution was implemented, which
 * not only avoids this problem but further decreases interrupt latencies
 * by adding an event post counter to the THREADINFO structure. This
 * counter frees the interrupt routines from dealing with linked lists
 * and frees the kernel from dealing with linked lists concurrently
 * modified by interrupts. Furthermore, timeout timers are now released
 * early. Michael Jones reported, that previous versions suffer from low
 * memory situations while processing many events within short periods.
 * The timer list is now double linked to reduce removal time. Internally
 * timeout condition is now flagged by setting the timer handle to
 * SIGNALED.
 * Unfortunately new bugs were introduced with this re-design. Special
 * thanks to Michael Jones, who located the "exact spot of the crime" and
 * proofed, that his final fixes let Nut/OS behave quite well under heavy
 * traffic storms. This new version will probably help also, if you
 * experienced long term instability.
 * LGPL copyright removed after all the initial sources had been finally
 * replaced by BSDL'ed code.
 * Last not least the documentation had been updated.
 *
 * Revision 1.23  2005/08/18 15:33:54  christianwelzel
 * Fixed bug in handling of NUTDEBUG.
 *
 * Revision 1.22  2005/07/21 14:23:17  freckle
 * inlined NutEventPostFromIrq call in NutEventPostAsync to reduce CS
 *
 * Revision 1.21  2005/07/20 09:19:45  haraldkipp
 * Use native heap calls to avoid dependencies
 *
 * Revision 1.20  2005/07/13 15:25:50  freckle
 * Rewrote NutEventWait to get short critical sections
 *
 * Revision 1.19  2005/07/12 18:44:05  freckle
 * Removed unnecessary critical sections in NutEventPost, NutEventWait
 *
 * Revision 1.18  2005/07/12 18:04:12  freckle
 * Reverted NutEventWait back to 1.15 but kept critical section in
 * NutEventTimeout + changed CS in NutEventWaitNext
 *
 * Revision 1.15  2005/06/10 12:59:26  freckle
 * corrected NuEventBroadcastAsync documentation.
 * NutEventBroadcast uses NutEventPostAsync which disables IRQsCVS:
 * ----------------------------------------------------------------------
 *
 * Revision 1.14  2005/02/21 12:37:57  phblum
 * Removed tabs and added semicolons after NUTTRACER macros
 *
 * Revision 1.13  2005/02/17 14:45:10  phblum
 * In NutEventWait(), replaced NutThreadRemoveQueue by direct removal of first thread in queue.
 *
 * Revision 1.12  2005/02/16 19:53:17  haraldkipp
 * Ready-to-run queue handling removed from interrupt context.
 *
 * Revision 1.11  2005/01/24 22:34:35  freckle
 * Added new tracer by Phlipp Blum <blum@tik.ee.ethz.ch>
 *
 * Revision 1.10  2005/01/24 21:11:21  freckle
 * renamed NutEventPostFromIRQ into NutEventPostFromIrq
 *
 * Revision 1.9  2005/01/21 16:49:44  freckle
 * Seperated calls to NutEventPostAsync between Threads and IRQs
 *
 * Revision 1.8  2005/01/19 17:59:45  freckle
 * Improved interrupt performance by reducing some critical section
 *
 * Revision 1.7  2005/01/02 10:07:10  haraldkipp
 * Replaced platform dependant formats in debug outputs.
 *
 * Revision 1.6  2004/07/20 08:33:28  freckle
 * Fixed NutPostEvent to give up CPU if there is another thread ready with
 * same priority to match the documentation
 * Also removed 'SWP..' NBUTDEBUG output, as switching is done calling NutThreadYield()
 *
 * Revision 1.5  2004/04/07 12:13:58  haraldkipp
 * Matthias Ringwald's *nix emulation added
 *
 * Revision 1.4  2004/03/19 09:05:12  jdubiec
 * Fixed format strings declarations for AVR.
 *
 * Revision 1.3  2004/03/16 16:48:45  haraldkipp
 * Added Jan Dubiec's H8/300 port.
 *
 * Revision 1.2  2003/07/20 18:27:44  haraldkipp
 * Explain how to disable timeout.
 *
 * Revision 1.1.1.1  2003/05/09 14:41:49  haraldkipp
 * Initial using 3.2.1
 *
 * Revision 1.20  2003/04/21 17:07:41  harald
 * Comments added
 *
 * Revision 1.19  2003/03/31 14:46:41  harald
 * Broadcasts clear signaled queues
 *
 * Revision 1.18  2003/02/04 18:15:56  harald
 * Version 3 released
 *
 * Revision 1.17  2003/01/14 16:56:39  harald
 * Racing condition on signaled events fixed.
 * All posting routines return the number of woken up threads.
 *
 * Revision 1.16  2002/06/26 17:29:44  harald
 * First pre-release with 2.4 stack
 *
 * 


Functions

void NutEventTimeout (HANDLE timer, void *arg)
 Timer callback in case of event timeout.
int NutEventWait (volatile HANDLE *qhp, u_long ms)
 Wait for an event in a specified queue.
int NutEventWaitNext (volatile HANDLE *qhp, u_long ms)
 Wait for a new event in a specified queue.
int NutEventPostAsync (volatile HANDLE *qhp)
 Asynchronously post an event to a specified queue.
int NutEventPost (volatile HANDLE *qhp)
 Post an event to a specified queue.
int NutEventBroadcastAsync (volatile HANDLE *qhp)
 Asynchronously broadcast an event to a specified queue.
int NutEventBroadcast (volatile HANDLE *qhp)
 Broadcast an event to a specified queue.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/