added: gc for sessions (another thread)

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@693 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2010-12-07 12:52:52 +00:00
parent 7f77b6e3ec
commit 0a9cdd2f15
16 changed files with 434 additions and 393 deletions

View File

@@ -67,6 +67,7 @@ App::App()
session_manager.SetConfig(&config);
session_manager.SetRequest(&request);
session_manager.SetSystem(&system);
session_manager.SetSynchro(&synchro);
post_multi_parser.SetConfig(&config);
}
@@ -218,10 +219,6 @@ void App::ProcessRequestThrow()
}
SendAnswer();
// it's better to remove sessions at the end of a request
// as it can take a little time
session_manager.DeleteOldSessions();
}
@@ -994,6 +991,7 @@ void App::WaitForThreads()
//pthread_join(signal_thread, 0);
system.notify.WaitForThread();
session_manager.WaitForGC();
}
@@ -1027,7 +1025,8 @@ sigset_t set;
app->synchro.was_stop_signal = true;
FCGX_ShutdownPending();
Ezc::WideToUTF8(app->config.base_url, app->url_to_fetch_on_exit);
app->system.notify.SendSignalToThread();
app->system.notify.PrepareToStopThread();
app->session_manager.PrepareToStopGC();
app->Unlock();
// this thread will hang on this method
@@ -1057,6 +1056,9 @@ sigset_t set;
// thread for notifications
system.notify.StartThread();
// gc for sessions
session_manager.StartGC();
}