From: brain Date: Sat, 17 Apr 2004 18:18:26 +0000 (+0000) Subject: Added calls to sched_yield() to cut down processor usage - won't work in *bsd X-Git-Tag: v2.0.23~10952 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=e81bad456aa55af8b0cb31d2ffeb0672ff0c6bbf;p=user%2Fhenk%2Fcode%2Finspircd.git Added calls to sched_yield() to cut down processor usage - won't work in *bsd git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@635 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/include/connection.h b/include/connection.h index c74a494b1..0d9bdb683 100644 --- a/include/connection.h +++ b/include/connection.h @@ -151,7 +151,7 @@ class ircd_connector : public classbase /** Class packet is deprecated. * This declaration is preserved here to maintain documentation only. */ -class packet +class packet : public classbase { }; diff --git a/include/dynamic.h b/include/dynamic.h index b34f2358b..0382324ce 100644 --- a/include/dynamic.h +++ b/include/dynamic.h @@ -53,13 +53,8 @@ class DLLManager class DLLFactoryBase : public DLLManager { public: - DLLFactoryBase( - const char *fname, - const char *func_name=0 - ); - + DLLFactoryBase(const char *fname, const char *func_name = 0); virtual ~DLLFactoryBase(); - void * (*factory_func)(void); }; @@ -83,19 +78,15 @@ class DLLFactoryBase : public DLLManager // is deleted, because the DLL will get unloaded as well. // -template -class DLLFactory : public DLLFactoryBase +template class DLLFactory : public DLLFactoryBase { public: - DLLFactory( - const char *fname, - const char *func_name=0 - ) : DLLFactoryBase( fname, func_name ) + DLLFactory(const char *fname, const char *func_name=0) : DLLFactoryBase(fname,func_name) { - if( factory_func ) - factory = (T *)factory_func(); - else - factory = 0; + if (factory_func) + factory = (T*)factory_func(); + else + factory = 0; } ~DLLFactory() diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 4c822e4ca..d18854dc6 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -4,7 +4,7 @@ -DLLManager::DLLManager( const char *fname ) +DLLManager::DLLManager(const char *fname) { // Try to open the library now and get any error message. @@ -20,10 +20,7 @@ DLLManager::~DLLManager() } -bool DLLManager::GetSymbol( - void **v, - const char *sym_name - ) +bool DLLManager::GetSymbol(void **v, const char *sym_name) { // try extract a symbol from the library // get any error message is there is any @@ -45,10 +42,7 @@ bool DLLManager::GetSymbol( } -DLLFactoryBase::DLLFactoryBase( - const char *fname, - const char *factory - ) : DLLManager(fname) +DLLFactoryBase::DLLFactoryBase(const char *fname, const char *factory) : DLLManager(fname) { // try get the factory function if there is no error yet diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 4f323c2cb..31200017d 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -41,6 +41,8 @@ using namespace std; #include #include #include +#include +#include #include "connection.h" #include "users.h" #include "servers.h" @@ -5842,7 +5844,7 @@ void process_command(userrec *user, char* cmd) { if (((command[x] < '0') || (command[x]> '9')) && (command[x] != '-')) { - if (strchr("@!\"$%^&*(){}[]_-=+;:'#~,.<>/?\\|`",command[x])) + if (!strchr("@!\"$%^&*(){}[]_-=+;:'#~,.<>/?\\|`",command[x])) { kill_link(user,"Protocol violation (3)"); return; @@ -7277,6 +7279,9 @@ int InspIRCd(void) /* main loop, this never returns */ for (;;) { +#ifdef _POSIX_PRIORITY_SCHEDULING + sched_yield(); +#endif fd_set sfd; timeval tval; @@ -7434,6 +7439,11 @@ int InspIRCd(void) //if (selectResult2 > 0) for (user_hash::iterator count2a = xcount; count2a != endingiter; count2a++) { + +#ifdef _POSIX_PRIORITY_SCHEDULING + sched_yield(); +#endif + result = EAGAIN; if ((count2a->second->fd != -1) && (FD_ISSET (count2a->second->fd, &sfd))) { diff --git a/src/modules.cpp b/src/modules.cpp index 472c6ca9e..cfb7b3092 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -15,7 +15,7 @@ // class type for holding an extended mode character - internal to core -class ExtMode +class ExtMode : public classbase { public: char modechar;