find_package(Qt4 REQUIRED QtCore QtGui QtSvg)
endif()
-find_package(Boost 1.42 COMPONENTS filesystem system REQUIRED)
+find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
# Find the platform's thread library (needed for C++11 threads).
# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
using namespace Qt;
+using boost::shared_lock;
+using boost::shared_mutex;
using std::lock_guard;
using std::map;
using std::mutex;
// Collect a set of signals
map<shared_ptr<Channel>, shared_ptr<Signal> > signal_map;
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<Signal> > &sigs(_session.signals());
for (const shared_ptr<Signal> &sig : sigs)
#include <libsigrok/libsigrok.hpp>
+using boost::shared_lock;
+using boost::shared_mutex;
+using boost::unique_lock;
+
using std::dynamic_pointer_cast;
using std::function;
using std::lock_guard;
-using std::mutex;
using std::list;
using std::map;
+using std::mutex;
using std::set;
using std::shared_ptr;
using std::string;
set< shared_ptr<data::SignalData> > SigSession::get_data() const
{
- lock_guard<mutex> lock(_signals_mutex);
+ shared_lock<shared_mutex> lock(_signals_mutex);
set< shared_ptr<data::SignalData> > data;
for (const shared_ptr<view::Signal> sig : _signals) {
assert(sig);
return data;
}
-mutex& SigSession::signals_mutex() const
+boost::shared_mutex& SigSession::signals_mutex() const
{
return _signals_mutex;
}
try
{
- lock_guard<mutex> lock(_signals_mutex);
+ lock_guard<boost::shared_mutex> lock(_signals_mutex);
// Create the decoder
decoder_stack = shared_ptr<data::DecoderStack>(
vector< shared_ptr<view::DecodeTrace> > SigSession::get_decode_signals() const
{
- lock_guard<mutex> lock(_signals_mutex);
+ shared_lock<shared_mutex> lock(_signals_mutex);
return _decode_traces;
}
// Make the Signals list
{
- lock_guard<mutex> lock(_signals_mutex);
+ unique_lock<shared_mutex> lock(_signals_mutex);
_signals.clear();
shared_ptr<view::Signal> SigSession::signal_from_channel(
shared_ptr<Channel> channel) const
{
- lock_guard<mutex> lock(_signals_mutex);
+ lock_guard<boost::shared_mutex> lock(_signals_mutex);
for (shared_ptr<view::Signal> sig : _signals) {
assert(sig);
if (sig->channel() == channel)
#include <thread>
#include <vector>
+#include <boost/thread.hpp>
+
#include <QObject>
#include <QString>
std::set< std::shared_ptr<data::SignalData> > get_data() const;
- std::mutex& signals_mutex() const;
+ boost::shared_mutex& signals_mutex() const;
const std::vector< std::shared_ptr<view::Signal> >& signals() const;
mutable std::mutex _sampling_mutex;
capture_state _capture_state;
- mutable std::mutex _signals_mutex;
+ mutable boost::shared_mutex _signals_mutex;
std::vector< std::shared_ptr<view::Signal> > _signals;
mutable std::mutex _data_mutex;
#include <libsigrok/libsigrok.hpp>
+using boost::shared_lock;
+using boost::shared_mutex;
+
using std::deque;
using std::dynamic_pointer_cast;
using std::lock_guard;
set< shared_ptr<data::SignalData> > data_set =
_session.get_data();
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<view::Signal> > &sigs(_session.signals());
// Check we have logic data
#include <pv/widgets/decodergroupbox.h>
#include <pv/widgets/decodermenu.h>
+using boost::shared_lock;
+using boost::shared_mutex;
using std::dynamic_pointer_cast;
using std::list;
using std::lock_guard;
using std::max;
using std::map;
using std::min;
-using std::mutex;
using std::pair;
using std::shared_ptr;
using std::tie;
{
assert(dec);
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<Signal> > &sigs(_session.signals());
assert(_decoder_stack);
map<const srd_channel*, shared_ptr<LogicSignal> > channel_map;
- lock_guard<mutex> lock(_session.signals_mutex());
+ shared_lock<shared_mutex> lock(_session.signals_mutex());
const vector< shared_ptr<Signal> > &sigs(_session.signals());
for (const ChannelSelector &s : _channel_selectors)
#include "pv/data/logic.h"
#include "pv/data/logicsnapshot.h"
+using boost::shared_lock;
+using boost::shared_mutex;
using pv::data::SignalData;
using std::back_inserter;
using std::deque;
using std::max;
using std::make_pair;
using std::min;
-using std::mutex;
using std::pair;
using std::set;
using std::shared_ptr;
set< shared_ptr<SignalData> > View::get_visible_data() const
{
- lock_guard<mutex> lock(session().signals_mutex());
+ shared_lock<shared_mutex> lock(session().signals_mutex());
const vector< shared_ptr<Signal> > &sigs(session().signals());
// Make a set of all the visible data objects
// Populate the traces
clear_child_items();
- lock_guard<mutex> lock(session().signals_mutex());
+ shared_lock<shared_mutex> lock(session().signals_mutex());
const vector< shared_ptr<Signal> > &sigs(session().signals());
for (auto s : sigs)
add_child_item(s);