mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
- nhttp: enable threading
This is ported from neutrino-mp and contains code by martii and seife from following commits: 20d3031b8bb47b5af79bf10c385e3564fe5c26dc93d01c1987
363633dc1b
c3e1310a2f727e26ce11669e3aeae78305f87049
This commit is contained in:
@@ -48,7 +48,7 @@ CWebserver::CWebserver() {
|
||||
FD_ZERO(&read_fds);
|
||||
fdmax = 0;
|
||||
open_connections = 0;
|
||||
#ifdef Y_CONFIG_BUILD_AS_DAEMON
|
||||
#ifdef Y_CONFIG_FEATURE_THREADING
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
#endif
|
||||
@@ -412,13 +412,13 @@ bool CWebserver::handle_connection(CySocket *newSock) {
|
||||
newConn->ySock = newSock;
|
||||
newConn->ySock->handling = true;
|
||||
newConn->WebserverBackref = this;
|
||||
#ifdef Y_CONFIG_BUILD_AS_DAEMON
|
||||
#ifdef Y_CONFIG_FEATURE_THREADING
|
||||
newConn->is_treaded = is_threading;
|
||||
#else
|
||||
newConn->is_treaded = false;
|
||||
#endif
|
||||
int index = -1;
|
||||
#ifdef Y_CONFIG_BUILD_AS_DAEMON
|
||||
#ifdef Y_CONFIG_FEATURE_THREADING
|
||||
if(is_threading)
|
||||
{
|
||||
pthread_mutex_lock( &mutex );
|
||||
@@ -442,7 +442,7 @@ bool CWebserver::handle_connection(CySocket *newSock) {
|
||||
|
||||
// start connection Thread
|
||||
if(pthread_create(&Connection_Thread_List[index], &attr, WebThread, (void *)newConn) != 0)
|
||||
dperror("Could not create Connection-Thread\n");
|
||||
dperror("Could not create Connection-Thread\n");
|
||||
}
|
||||
else // non threaded
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user