From 4f241ebda471abd76bb77e1d359e2d1bf1469524 Mon Sep 17 00:00:00 2001 From: Dave West Date: Fri, 30 Nov 2007 19:18:28 +0000 Subject: [PATCH] Small optimisation for CtdlThreadSelect(). Now takes a pointer to this thread. --- citadel/include/ctdl_module.h | 2 ++ citadel/sysdep.c | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/citadel/include/ctdl_module.h b/citadel/include/ctdl_module.h index c2a20630d..781351433 100644 --- a/citadel/include/ctdl_module.h +++ b/citadel/include/ctdl_module.h @@ -118,6 +118,8 @@ struct CtdlThreadNode *CtdlThreadSelf(void); int CtdlThreadGetCount(void); void CtdlThreadGC(void); void CtdlThreadStopAll(void); +int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, struct CtdlThreadNode *self); + /* Macros to speed up getting outr thread */ #define CT _this_cit_thread #define CT_PUSH() \ diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 5f27ad681..35a5ed008 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -1785,12 +1785,10 @@ struct CtdlThreadNode *CtdlThreadCreate(char *name, long flags, void *(*thread_f /* * A warapper function for select so we can show a thread as blocked */ -int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout) +int CtdlThreadSelect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timeval *timeout, struct CtdlThreadNode *self) { - struct CtdlThreadNode *self; int ret; - self = CtdlThreadSelf(); ctdl_thread_internal_change_state(self, CTDL_THREAD_BLOCKED); ret = select(n, readfds, writefds, exceptfds, timeout); ctdl_thread_internal_change_state(self, CTDL_THREAD_RUNNING); @@ -1973,7 +1971,7 @@ do_select: force_purge = 0; if (!CtdlThreadCheckStop(CT)) { tv.tv_sec = 1; /* wake up every second if no input */ tv.tv_usec = 0; - retval = CtdlThreadSelect(highest + 1, &readfds, NULL, NULL, &tv); + retval = CtdlThreadSelect(highest + 1, &readfds, NULL, NULL, &tv, CT); // retval = select(highest + 1, &readfds, NULL, NULL, &tv); } -- 2.30.2