merged alert fix from libtorrent_aio

This commit is contained in:
Arvid Norberg 2012-11-12 06:08:06 +00:00
parent 52b205e6cb
commit 58d5b9aedc
1 changed files with 4 additions and 10 deletions

View File

@ -408,13 +408,8 @@ namespace libtorrent {
void alert_manager::post_alert_ptr(alert* alert_) void alert_manager::post_alert_ptr(alert* alert_)
{ {
std::auto_ptr<alert> a(alert_); std::auto_ptr<alert> a(alert_);
mutex::scoped_lock lock(m_mutex);
post_impl(a);
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
lock.unlock();
for (ses_extension_list_t::iterator i = m_ses_extensions.begin() for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
, end(m_ses_extensions.end()); i != end; ++i) , end(m_ses_extensions.end()); i != end; ++i)
{ {
@ -424,18 +419,15 @@ namespace libtorrent {
} }
#endif #endif
mutex::scoped_lock lock(m_mutex);
post_impl(a);
} }
void alert_manager::post_alert(const alert& alert_) void alert_manager::post_alert(const alert& alert_)
{ {
std::auto_ptr<alert> a(alert_.clone()); std::auto_ptr<alert> a(alert_.clone());
mutex::scoped_lock lock(m_mutex);
post_impl(a);
#ifndef TORRENT_DISABLE_EXTENSIONS #ifndef TORRENT_DISABLE_EXTENSIONS
lock.unlock();
for (ses_extension_list_t::iterator i = m_ses_extensions.begin() for (ses_extension_list_t::iterator i = m_ses_extensions.begin()
, end(m_ses_extensions.end()); i != end; ++i) , end(m_ses_extensions.end()); i != end; ++i)
{ {
@ -445,6 +437,8 @@ namespace libtorrent {
} }
#endif #endif
mutex::scoped_lock lock(m_mutex);
post_impl(a);
} }
void alert_manager::post_impl(std::auto_ptr<alert>& alert_) void alert_manager::post_impl(std::auto_ptr<alert>& alert_)