From: Pekka Riikonen Date: Fri, 6 May 2005 11:20:26 +0000 (+0000) Subject: Check for valid scheduler after selecting timeout (it may dispatch). X-Git-Tag: silc.1.0.branch.tag.20050510~7 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=0c030adc3ed64f7a346bdc8cce8adc4635bf8697 Check for valid scheduler after selecting timeout (it may dispatch). --- diff --git a/lib/silcutil/silcschedule.c b/lib/silcutil/silcschedule.c index 5ea2ebf0..169f4535 100644 --- a/lib/silcutil/silcschedule.c +++ b/lib/silcutil/silcschedule.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - Copyright (C) 1998 - 2003 Pekka Riikonen + Copyright (C) 1998 - 2005 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -607,6 +607,16 @@ bool silc_schedule_one(SilcSchedule schedule, int timeout_usecs) return FALSE; } + /* If the task queues aren't initialized or we aren't valid anymore + we will return */ + if ((!schedule->fd_queue && !schedule->timeout_queue + && !schedule->generic_queue) || schedule->valid == FALSE) { + SILC_LOG_DEBUG(("Scheduler not valid anymore, exiting")); + if (!schedule->is_locked) + SILC_SCHEDULE_UNLOCK(schedule); + return FALSE; + } + /* Calculate next timeout for silc_select(). This is the timeout value when at earliest some of the timeout tasks expire. */ silc_mutex_lock(schedule->timeout_queue->lock);