From f93a48599e47f60ab75f57214c4546de04d9e2db Mon Sep 17 00:00:00 2001 From: adamdunkels Date: Thu, 24 Jan 2008 21:00:51 +0000 Subject: [PATCH] Process only one poll request at a time to avoid starvation if one process keeps calling process_poll() from its poll handler --- core/sys/process.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/core/sys/process.c b/core/sys/process.c index ba9816e1a..5f5655157 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.7 2008/01/23 21:06:25 adamdunkels Exp $ + * @(#)$Id: process.c,v 1.8 2008/01/24 21:00:51 adamdunkels Exp $ */ /** @@ -234,17 +234,15 @@ do_poll(void) { struct process *p; - do { - poll_requested = 0; - /* Call the processes that needs to be polled. */ - for(p = process_list; p != NULL; p = p->next) { - if(p->needspoll) { - p->state = PROCESS_STATE_RUNNING; - p->needspoll = 0; - call_process(p, PROCESS_EVENT_POLL, NULL); - } + poll_requested = 0; + /* Call the processes that needs to be polled. */ + for(p = process_list; p != NULL; p = p->next) { + if(p->needspoll) { + p->state = PROCESS_STATE_RUNNING; + p->needspoll = 0; + call_process(p, PROCESS_EVENT_POLL, NULL); } - } while(poll_requested); + } } /*---------------------------------------------------------------------------*/ /*