From e4e3a11b8bdc29f62296d98cc555f598fc1ff5e2 Mon Sep 17 00:00:00 2001 From: bg- Date: Thu, 17 Aug 2006 15:39:24 +0000 Subject: [PATCH] New function process_nevents(). --- core/sys/process.c | 12 +++++++++++- core/sys/process.h | 12 ++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core/sys/process.c b/core/sys/process.c index 7e7ce9648..7ee93ecdd 100644 --- a/core/sys/process.c +++ b/core/sys/process.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: process.c,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $ + * @(#)$Id: process.c,v 1.2 2006/08/17 15:39:24 bg- Exp $ */ /** @@ -353,6 +353,16 @@ process_run(void) } /*---------------------------------------------------------------------------*/ int +process_nevents(void) +{ +#ifdef NPOLLS + return nevents + npolls; +#else + return nevents + poll_requested; +#endif +} +/*---------------------------------------------------------------------------*/ +int process_post(struct process *p, process_event_t ev, process_data_t data) { static unsigned char snum; diff --git a/core/sys/process.h b/core/sys/process.h index 1d689de30..2706209f6 100644 --- a/core/sys/process.h +++ b/core/sys/process.h @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: process.h,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $ + * @(#)$Id: process.h,v 1.2 2006/08/17 15:39:25 bg- Exp $ */ /** @@ -503,7 +503,7 @@ void process_init(void); * Run the system once - call poll handlers and process one event. * * This function should be called repeatedly from the main() program - * to actuall run the Contiki system. It calls the necessary poll + * to actually run the Contiki system. It calls the necessary poll * handlers, and processes one event. The function returns the number * of events that are waiting in the event queue so that the caller * may choose to put the CPU to sleep when there are no pending @@ -514,6 +514,14 @@ void process_init(void); */ int process_run(void); +/** + * Number of events waiting to be processed. + * + * \return The number of events that are currently waiting to be + * processed. + */ +int process_nevents(void); + /** @} */ extern struct process *process_list;