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

@@ -19,7 +19,7 @@
Notify::Notify() : thread_signal(PTHREAD_COND_INITIALIZER)
Notify::Notify()
{
}
@@ -62,9 +62,7 @@ void Notify::Init()
notify_thread.SetUsers(users);
notify_thread.SetNotifyPool(&notify_pool);
notify_thread.SetPatterns(&patterns);
notify_thread.SetSynchro(synchro);
notify_thread.SetSignal(&thread_signal);
notify_template_cms = AddTemplate(L"notify_email_cms.txt"); // !! do konfiga
notify_template_thread = AddTemplate(L"notify_email_thread.txt");
@@ -133,7 +131,7 @@ void Notify::ItemChanged(int notify_code, const Item & item)
void Notify::ItemChanged(const NotifyMsg & msg)
{
notify_pool.Add(msg);
SendSignalToThread(); // we are in the first locked thread
notify_thread.WakeUpThread(); // we are in the first locked thread
}
@@ -145,6 +143,13 @@ void Notify::StartThread()
}
void Notify::PrepareToStopThread()
{
// synchro->was_stop_signal is true
notify_thread.WakeUpThread();
}
void Notify::WaitForThread()
{
notify_thread.WaitForThread();
@@ -186,8 +191,3 @@ static std::wstring tmp_path;
void Notify::SendSignalToThread()
{
// you should use it with: synchro->Lock() and Unlock()
pthread_cond_signal(&thread_signal);
}