void TApplicationServer::terminate() { close(); switch ( Tf::app()->multiProcessingModule() ) { case TWebApplication::Thread: case TWebApplication::Prefork: if (actionContextCount() > 0) { setMutex.lock(); for (QSetIterator<TActionContext *> i(actionContexts); i.hasNext(); ) { i.next()->stop(); } setMutex.unlock(); for (;;) { qApp->processEvents(); QMutexLocker locker(&setMutex); if (actionContexts.isEmpty()) { break; } } } break; default: break; } }
void TApplicationServer::incomingConnection(int socketDescriptor) { T_TRACEFUNC("socketDescriptor: %d", socketDescriptor); switch ( Tf::app()->multiProcessingModule() ) { case TWebApplication::Thread: for (;;) { if (actionContextCount() < maxServers) { TActionThread *thread = new TActionThread(socketDescriptor); connect(thread, SIGNAL(finished()), this, SLOT(deleteActionContext())); insertPointer(thread); thread->start(); break; } Tf::msleep(1); qApp->processEvents(QEventLoop::ExcludeSocketNotifiers); } break; case TWebApplication::Prefork: { close(); // Closes the listening port TActionForkProcess *process = new TActionForkProcess(socketDescriptor); connect(process, SIGNAL(finished()), this, SLOT(deleteActionContext())); insertPointer(process); process->start(); break; } default: break; } }
void TApplicationServer::terminate() { close(); if (actionContextCount() > 0) { setMutex.lock(); for (QSetIterator<TActionContext *> i(actionContexts); i.hasNext(); ) { i.next()->stop(); // Stops application server } setMutex.unlock(); for (;;) { qApp->processEvents(); QMutexLocker locker(&setMutex); if (actionContexts.isEmpty()) { break; } } } }