struct CitContext *this;
this = CreateNewContext();
+ CtdlThreadSleep(1);
this->kill_me = 1;
this->state = CON_IDLE;
dead_session_purge(1);
{
long stats = statcount;
- while(stats) {
+ while(stats && !CtdlThreadCheckStop()) {
CtdlThreadCreate("Connection simulation worker", CTDLTHREAD_BIGSTACK, simulation_worker, NULL);
stats--;
}
CtdlThreadNode *last_worker;
struct timeval start, now, result;
double last_duration;
-
+
/*
* Initialise the thread system
*/
#endif /* NEW_WORKER */
{
/* Only start new threads if we are not going to overload the machine */
- if (CtdlThreadGetLoadAvg() < ((double)1.00)) {
+ /* Temporarily set to 10 should be enough to make sure we don't stranglew the server
+ * at least until we make this a config option */
+ if (CtdlThreadGetLoadAvg() < ((double)10.00)) {
for (i=0; i<5 ; i++) {
#ifdef NEW_WORKER
CtdlThreadCreate("Worker Thread (new)",
#ifdef THREADS_USESIGNALS
if (CtdlThreadGetCount() && CT->state > CTDL_THREAD_STOP_REQ)
#else
- if (CtdlThreadGetCount() && !statcount)
+ if (CtdlThreadGetCount())
#endif
CtdlThreadSleep(1);
}
int m, i;
int retval = 0;
struct timeval tv;
- struct CitContext *con;
+ CitContext *con;
const char *old_name;
* If the select succeeds the thread goes off to handle the client request.
* If the list of client connections is empty the threads all sleep for one second
*/
-struct CitContext *select_on_client(void)
+CitContext *select_on_client(void)
{
fd_set readfds;
struct timeval tv;
/*
* Do the worker threads work when needed
*/
-int execute_session(struct CitContext *bind_me)
+int execute_session(CitContext *bind_me)
{
int force_purge;
void *new_worker_thread(void *arg)
{
- struct CitContext *bind_me;
+ CitContext *bind_me;
int force_purge;
while (!CtdlThreadCheckStop()) {