using namespace Qt;
+using std::lock_guard;
using std::map;
+using std::mutex;
using std::set;
using std::shared_ptr;
using std::vector;
// Collect a set of signals
map<shared_ptr<Channel>, shared_ptr<Signal> > signal_map;
- const vector< shared_ptr<Signal> > sigs = _session.get_signals();
+
+ lock_guard<mutex> lock(_session.signals_mutex());
+ const vector< shared_ptr<Signal> > &sigs(_session.signals());
for (const shared_ptr<Signal> &sig : sigs)
signal_map[sig->channel()] = sig;
return data;
}
-vector< shared_ptr<view::Signal> > SigSession::get_signals() const
+mutex& SigSession::signals_mutex() const
+{
+ return _signals_mutex;
+}
+
+const vector< shared_ptr<view::Signal> >& SigSession::signals() const
{
- lock_guard<mutex> lock(_signals_mutex);
return _signals;
}
std::set< std::shared_ptr<data::SignalData> > get_data() const;
- std::vector< std::shared_ptr<view::Signal> >
- get_signals() const;
+ std::mutex& signals_mutex() const;
+
+ const std::vector< std::shared_ptr<view::Signal> >& signals() const;
#ifdef ENABLE_DECODE
bool add_decoder(srd_decoder *const dec);
{
set< shared_ptr<data::SignalData> > data_set =
_session.get_data();
- const vector< shared_ptr<view::Signal> > sigs =
- _session.get_signals();
+
+ lock_guard<mutex> lock(_session.signals_mutex());
+ const vector< shared_ptr<view::Signal> > &sigs(_session.signals());
// Check we have logic data
if (data_set.empty() || sigs.empty()) {
#include <libsigrokdecode/libsigrokdecode.h>
}
+#include <mutex>
+
#include <extdef.h>
#include <tuple>
using std::dynamic_pointer_cast;
using std::list;
+using std::lock_guard;
using std::make_pair;
using std::max;
using std::map;
using std::min;
+using std::mutex;
using std::pair;
using std::shared_ptr;
using std::tie;
{
assert(dec);
- const vector< shared_ptr<Signal> > sigs = _session.get_signals();
+ lock_guard<mutex> lock(_session.signals_mutex());
+ const vector< shared_ptr<Signal> > &sigs(_session.signals());
assert(_decoder_stack);
const auto channel_iter = dec->channels().find(pdch);
assert(dec);
map<const srd_channel*, shared_ptr<LogicSignal> > channel_map;
- const vector< shared_ptr<Signal> > sigs = _session.get_signals();
+
+ lock_guard<mutex> lock(_session.signals_mutex());
+ const vector< shared_ptr<Signal> > &sigs(_session.signals());
for (const ChannelSelector &s : _channel_selectors)
{
#include <libsigrokdecode/libsigrokdecode.h>
#endif
-#include <assert.h>
-#include <limits.h>
-#include <math.h>
+#include <cassert>
+#include <climits>
+#include <cmath>
+#include <mutex>
#include <QEvent>
#include <QMouseEvent>
using std::back_inserter;
using std::deque;
using std::list;
+using std::lock_guard;
using std::max;
using std::make_pair;
using std::min;
+using std::mutex;
using std::pair;
using std::set;
using std::shared_ptr;
{
using pv::data::SignalData;
- const vector< shared_ptr<Signal> > sigs(
- session().get_signals());
-
// Make a set of all the visible data objects
set< shared_ptr<SignalData> > visible_data = get_visible_data();
if (visible_data.empty())
set< shared_ptr<SignalData> > View::get_visible_data() const
{
- const vector< shared_ptr<Signal> > sigs(
- session().get_signals());
+ lock_guard<mutex> lock(session().signals_mutex());
+ const vector< shared_ptr<Signal> > &sigs(session().signals());
// Make a set of all the visible data objects
set< shared_ptr<SignalData> > visible_data;
// Populate the traces
clear_child_items();
- const vector< shared_ptr<Signal> > sigs(
- session().get_signals());
+ lock_guard<mutex> lock(session().signals_mutex());
+ const vector< shared_ptr<Signal> > &sigs(session().signals());
for (auto s : sigs)
add_child_item(s);