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:
@@ -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(¬ify_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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user