]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Added calls to sched_yield() to cut down processor usage - won't work in *bsd
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 17 Apr 2004 18:18:26 +0000 (18:18 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Sat, 17 Apr 2004 18:18:26 +0000 (18:18 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@635 e03df62e-2008-0410-955e-edbf42e46eb7

include/connection.h
include/dynamic.h
src/dynamic.cpp
src/inspircd.cpp
src/modules.cpp

index c74a494b1ce6257d5c335bd79a5f6fb217c49012..0d9bdb683c3a0211c53a528a1f8219457c572285 100644 (file)
@@ -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
 {
 };
 
index b34f2358b53f28805d373fe35ba605e7cc126988..0382324ce435774e1cfe3eebff1666495033507e 100644 (file)
@@ -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 T>
-class DLLFactory : public DLLFactoryBase
+template <class T> 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()
index 4c822e4ca0a980e36c210437185443d5bc150a3b..d18854dc6ada1a2c155328b85621eff8077c396f 100644 (file)
@@ -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
        
index 4f323c2cbf026e290f73b73c52a63e16db013271..31200017d2cc2eaf4dd6b1e645c21be6cc58eec4 100644 (file)
@@ -41,6 +41,8 @@ using namespace std;
 #include <errno.h>
 #include <deque>
 #include <errno.h>
+#include <unistd.h>
+#include <sched.h>
 #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)))
                                {
index 472c6ca9ebbf6ac2825d3ec866977cc83d61b383..cfb7b3092224b22d63fa687aa37d9319ab63249d 100644 (file)
@@ -15,7 +15,7 @@
 
 // class type for holding an extended mode character - internal to core
 
-class ExtMode
+class ExtMode : public classbase
 {
 public:
        char modechar;