git://git.jankratochvil.net
/
middleman.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Removed threading
[middleman.git]
/
src
/
main.c
diff --git
a/src/main.c
b/src/main.c
index
f188421
..
d870628
100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-27,6
+27,7
@@
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
#include <fcntl.h>
#include <pwd.h>
#include <grp.h>
+#include <sys/wait.h>
#include "proto.h"
#ifdef USE_SYSLOG
#include "proto.h"
#ifdef USE_SYSLOG
@@
-512,6
+513,11
@@
void mainloop()
}
}
}
}
+static void sigchld(int signo)
+{
+ while (waitpid(-1,NULL,WNOHANG)>0);
+}
+
/*
create new thread
*/
/*
create new thread
*/
@@
-548,7
+554,12
@@
int process_new(CONNECTION * connection)
if (getuid() == 0)
pthread_attr_setschedpolicy(&thread_attr, SCHED_FIFO);
if (getuid() == 0)
pthread_attr_setschedpolicy(&thread_attr, SCHED_FIFO);
- perr = pthread_create(&thread_id, &thread_attr, (void *) process_entry, (void *) connection);
+ signal(SIGCHLD,sigchld);
+ if (0==(perr=fork())) {
+ process_entry(connection);
+ _exit(0);
+ }
+ perr=close(connection->client->fd)
pthread_attr_destroy(&thread_attr);
pthread_attr_destroy(&thread_attr);