mirror of
https://github.com/Icinga/icinga2.git
synced 2025-04-08 17:05:25 +02:00
Fix deadlock in WorkQueue::Enqueue().
This commit is contained in:
parent
919af6c539
commit
eed901304a
lib/base
@ -23,8 +23,8 @@
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
WorkQueue::WorkQueue(size_t maxItems)
|
||||
: m_MaxItems(maxItems), m_Executing(false)
|
||||
WorkQueue::WorkQueue(void)
|
||||
: m_Executing(false)
|
||||
{ }
|
||||
|
||||
WorkQueue::~WorkQueue(void)
|
||||
@ -40,9 +40,6 @@ void WorkQueue::Enqueue(const WorkCallback& item)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
while (m_Items.size() >= m_MaxItems)
|
||||
m_CV.wait(lock);
|
||||
|
||||
m_Items.push_back(item);
|
||||
m_CV.notify_all();
|
||||
|
||||
@ -87,4 +84,5 @@ void WorkQueue::ExecuteItem(void)
|
||||
}
|
||||
|
||||
m_Executing = false;
|
||||
m_CV.notify_all();
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class I2_BASE_API WorkQueue
|
||||
public:
|
||||
typedef boost::function<void (void)> WorkCallback;
|
||||
|
||||
WorkQueue(size_t maxItems = 25000);
|
||||
WorkQueue(void);
|
||||
~WorkQueue(void);
|
||||
|
||||
void Enqueue(const WorkCallback& item);
|
||||
|
Loading…
x
Reference in New Issue
Block a user