misc: Fix a bunch of minor issues identified by static analysis
Add some missing initialisation, and fix a handful benign resource leaks (including some false positives).
This commit is contained in:
@@ -460,29 +460,28 @@ Event::dump() const
|
||||
}
|
||||
|
||||
EventQueue::EventQueue(const string &n)
|
||||
: objName(n), head(NULL), _curTick(0),
|
||||
async_queue_mutex(new std::mutex())
|
||||
: objName(n), head(NULL), _curTick(0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
EventQueue::asyncInsert(Event *event)
|
||||
{
|
||||
async_queue_mutex->lock();
|
||||
async_queue_mutex.lock();
|
||||
async_queue.push_back(event);
|
||||
async_queue_mutex->unlock();
|
||||
async_queue_mutex.unlock();
|
||||
}
|
||||
|
||||
void
|
||||
EventQueue::handleAsyncInsertions()
|
||||
{
|
||||
assert(this == curEventQueue());
|
||||
async_queue_mutex->lock();
|
||||
async_queue_mutex.lock();
|
||||
|
||||
while (!async_queue.empty()) {
|
||||
insert(async_queue.front());
|
||||
async_queue.pop_front();
|
||||
}
|
||||
|
||||
async_queue_mutex->unlock();
|
||||
async_queue_mutex.unlock();
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
#include <cassert>
|
||||
#include <climits>
|
||||
#include <iosfwd>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
|
||||
@@ -448,7 +449,7 @@ class EventQueue : public Serializable
|
||||
Tick _curTick;
|
||||
|
||||
//! Mutex to protect async queue.
|
||||
std::mutex *async_queue_mutex;
|
||||
std::mutex async_queue_mutex;
|
||||
|
||||
//! List of events added by other threads to this event queue.
|
||||
std::list<Event*> async_queue;
|
||||
|
||||
Reference in New Issue
Block a user