From: Michael Hampton Date: Sat, 15 May 2004 14:19:52 +0000 (+0000) Subject: * Scheduler: when next_session is to be deleted, make it point to some X-Git-Tag: v7.86~5432 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=17e73cab84995c024c2df80e4bc0a513b0793ea1;p=citadel.git * Scheduler: when next_session is to be deleted, make it point to some other session which isn't being deleted (or NULL if there aren't any). --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index c74b3cb7e..b9d6083a7 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,8 @@ $Log$ + Revision 620.34 2004/05/15 14:19:52 error + * Scheduler: when next_session is to be deleted, make it point to some + other session which isn't being deleted (or NULL if there aren't any). + Revision 620.33 2004/05/14 03:09:54 ajc * When a session kills itself (for example, due to a broken socket), force the dead_session_purge() to run immediately. This avoids @@ -5772,3 +5776,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citserver.c b/citadel/citserver.c index 8fd945e5f..6612d1f91 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -63,6 +63,7 @@ #endif struct CitContext *ContextList = NULL; +struct CitContext* next_session = NULL; char *unique_session_numbers; int ScheduledShutdown = 0; int do_defrag = 0; @@ -204,6 +205,9 @@ void RemoveContext (struct CitContext *con) else { for (ptr = ContextList; ptr != NULL; ptr = ptr->next) { if (ptr->next == con) { + /* See fair scheduling in sysdep.c */ + if (next_session == ptr->next) + next_session = ptr->next->next; ToFree = ptr->next; ptr->next = ptr->next->next; --num_sessions; diff --git a/citadel/sysdep.c b/citadel/sysdep.c index b9e6079fc..9c2816735 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -103,6 +103,8 @@ pthread_t initial_thread; /* tid for main() thread */ int syslog_facility = (-1); +/* This is synchronized below; it helps implement round robin mode */ +extern struct CitContext* next_session; /* * lprintf() ... Write logging information @@ -905,8 +907,6 @@ void *worker_thread(void *arg) { int i; char junk; int highest; - /* This is synchronized below; it helps implement round robin mode */ - static struct CitContext* next_session = NULL; struct CitContext *ptr; struct CitContext *bind_me = NULL; fd_set readfds;