alert improvements

This commit is contained in:
Arvid Norberg 2009-02-21 10:21:28 +00:00
parent 8ce5774307
commit 95829383a8
1 changed files with 11 additions and 2 deletions

View File

@ -122,11 +122,20 @@ namespace libtorrent {
std::auto_ptr<alert> get();
template <class T>
bool should_post() const { return (m_alert_mask & T::static_category) != 0; }
bool should_post() const
{
boost::mutex::scoped_lock lock(m_mutex);
if (m_alerts.size() >= m_queue_size_limit) return false;
return (m_alert_mask & T::static_category) != 0;
}
alert const* wait_for_alert(time_duration max_wait);
void set_alert_mask(int m) { m_alert_mask = m; }
void set_alert_mask(int m)
{
boost::mutex::scoped_lock lock(m_mutex);
m_alert_mask = m;
}
size_t alert_queue_size_limit() const { return m_queue_size_limit; }
size_t set_alert_queue_size_limit(size_t queue_size_limit_);