diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-17 18:18:26 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2004-04-17 18:18:26 +0000 |
commit | e81bad456aa55af8b0cb31d2ffeb0672ff0c6bbf (patch) | |
tree | 2330a8e8d362ae33a4a83d92be789c01a9dabd61 /src/inspircd.cpp | |
parent | 3345b6c0dc26bf5f5ab848a22b9b5f2887e51574 (diff) |
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
Diffstat (limited to 'src/inspircd.cpp')
-rw-r--r-- | src/inspircd.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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 <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))) { |