# This option is user configurable, but enable it by default on win32.
set(STATIC_PKGDEPS_LIBS TRUE)
- # For boost-thread we need two additional settings on win32:
- set(Boost_USE_STATIC_LIBS ON)
- add_definitions(-DBOOST_THREAD_USE_LIB)
-
# Windows does not support UNIX signals.
set(ENABLE_SIGNALS FALSE)
endif()
find_program(QT_QMAKE_EXECUTABLE NAMES qmake4 qmake-qt4 qmake-mac)
find_package(Qt4 REQUIRED)
-# Find the platform's thread library (needed for boost-thread).
-# This will set ${CMAKE_THREAD_LIBS_INIT} to the correct, OS-specific value.
-find_package(Threads)
-
-if(WIN32)
- # On Windows/MinGW we need to use 'thread_win32' instead of 'thread'.
- # The library is named libboost_thread_win32* (not libboost_thread*).
- find_package(Boost 1.42 COMPONENTS filesystem system thread_win32 REQUIRED)
-else()
- find_package(Boost 1.42 COMPONENTS filesystem system thread REQUIRED)
-endif()
+find_package(Boost 1.42 COMPONENTS filesystem system REQUIRED)
#===============================================================================
#= System Introspection
set(PULSEVIEW_LINK_LIBS
${Boost_LIBRARIES}
- ${CMAKE_THREAD_LIBS_INIT}
${QT_LIBRARIES}
)
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cassert>
+
#include "analog.h"
#include "analogsnapshot.h"
#include "analogsnapshot.h"
-using boost::lock_guard;
-using boost::recursive_mutex;
+using std::lock_guard;
+using std::recursive_mutex;
using std::max;
using std::max_element;
using std::min;
#include <libsigrokdecode/libsigrokdecode.h>
-#include <boost/thread/thread.hpp>
-
#include <stdexcept>
#include <QDebug>
#include <pv/sigsession.h>
#include <pv/view/logicsignal.h>
-using boost::lock_guard;
-using boost::mutex;
+using std::lock_guard;
+using std::mutex;
using boost::optional;
-using boost::unique_lock;
+using std::unique_lock;
using std::deque;
using std::make_pair;
using std::max;
DecoderStack::~DecoderStack()
{
if (_decode_thread.joinable()) {
- _decode_thread.interrupt();
+ _interrupt = true;
_decode_thread.join();
}
}
shared_ptr<pv::data::Logic> data;
if (_decode_thread.joinable()) {
- _decode_thread.interrupt();
+ _interrupt = true;
_decode_thread.join();
}
if (_samplerate == 0.0)
_samplerate = 1.0;
- _decode_thread = boost::thread(&DecoderStack::decode_proc, this);
+ _interrupt = false;
+ _decode_thread = std::thread(&DecoderStack::decode_proc, this);
}
uint64_t DecoderStack::get_max_sample_count() const
optional<int64_t> DecoderStack::wait_for_data() const
{
unique_lock<mutex> input_lock(_input_mutex);
- while(!boost::this_thread::interruption_requested() &&
- !_frame_complete && _samples_decoded >= _sample_count)
+ while(!_interrupt && !_frame_complete &&
+ _samples_decoded >= _sample_count)
_input_cond.wait(input_lock);
- return boost::make_optional(
- !boost::this_thread::interruption_requested() &&
+ return boost::make_optional(!_interrupt &&
(_samples_decoded < _sample_count || !_frame_complete),
_sample_count);
}
const unsigned int chunk_sample_count =
DecodeChunkLength / _snapshot->unit_size();
- for (int64_t i = 0;
- !boost::this_thread::interruption_requested() &&
- i < sample_count;
+ for (int64_t i = 0; !_interrupt && i < sample_count;
i += chunk_sample_count)
{
lock_guard<mutex> decode_lock(_global_decode_mutex);
#include "signaldata.h"
+#include <atomic>
+#include <condition_variable>
#include <list>
+#include <map>
#include <memory>
+#include <thread>
#include <boost/optional.hpp>
-#include <boost/thread.hpp>
#include <QObject>
#include <QString>
* @todo A proper solution should be implemented to allow multiple
* decode operations.
*/
- static boost::mutex _global_decode_mutex;
+ static std::mutex _global_decode_mutex;
std::list< std::shared_ptr<decode::Decoder> > _stack;
std::shared_ptr<pv::data::LogicSnapshot> _snapshot;
- mutable boost::mutex _input_mutex;
- mutable boost::condition_variable _input_cond;
+ mutable std::mutex _input_mutex;
+ mutable std::condition_variable _input_cond;
int64_t _sample_count;
bool _frame_complete;
- mutable boost::mutex _output_mutex;
+ mutable std::mutex _output_mutex;
int64_t _samples_decoded;
std::map<const decode::Row, decode::RowData> _rows;
QString _error_message;
- boost::thread _decode_thread;
+ std::thread _decode_thread;
+ std::atomic<bool> _interrupt;
friend class DecoderStackTest::TwoDecoderStack;
};
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <cassert>
+
#include "logic.h"
#include "logicsnapshot.h"
#include "config.h"
#include "logicsnapshot.h"
-using boost::lock_guard;
-using boost::recursive_mutex;
+using std::lock_guard;
+using std::recursive_mutex;
using std::max;
using std::min;
using std::pair;
#include <stdlib.h>
#include <string.h>
-using boost::lock_guard;
-using boost::recursive_mutex;
+using std::lock_guard;
+using std::recursive_mutex;
namespace pv {
namespace data {
#include <libsigrok/libsigrok.h>
-#include <boost/thread.hpp>
+#include <thread>
+#include <mutex>
namespace pv {
namespace data {
void append_data(void *data, uint64_t samples);
protected:
- mutable boost::recursive_mutex _mutex;
+ mutable std::recursive_mutex _mutex;
void *_data;
uint64_t _sample_count;
uint64_t _capacity;
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "storeprogress.h"
+#include <cassert>
#include <QMessageBox>
+#include "storeprogress.h"
+
namespace pv {
namespace dialogs {
#include "view/decodetrace.h"
#include "view/logicsignal.h"
-#include <assert.h>
-
+#include <cassert>
+#include <mutex>
#include <stdexcept>
#include <sys/stat.h>
#include <QDebug>
using boost::function;
-using boost::lock_guard;
-using boost::mutex;
using std::dynamic_pointer_cast;
+using std::lock_guard;
+using std::mutex;
using std::list;
using std::map;
using std::set;
}
// Begin the session
- _sampling_thread = boost::thread(
+ _sampling_thread = std::thread(
&SigSession::sample_thread_proc, this, _dev_inst,
error_handler);
}
#define PULSEVIEW_PV_SIGSESSION_H
#include <boost/function.hpp>
-#include <boost/thread.hpp>
#include <map>
#include <memory>
+#include <mutex>
#include <set>
#include <string>
+#include <thread>
#include <vector>
#include <QObject>
std::vector< std::shared_ptr<view::DecodeTrace> > _decode_traces;
- mutable boost::mutex _sampling_mutex;
+ mutable std::mutex _sampling_mutex;
capture_state _capture_state;
- mutable boost::mutex _signals_mutex;
+ mutable std::mutex _signals_mutex;
std::vector< std::shared_ptr<view::Signal> > _signals;
- mutable boost::mutex _data_mutex;
+ mutable std::mutex _data_mutex;
std::shared_ptr<data::Logic> _logic_data;
std::shared_ptr<data::LogicSnapshot> _cur_logic_snapshot;
std::map< const sr_channel*, std::shared_ptr<data::AnalogSnapshot> >
_cur_analog_snapshots;
- boost::thread _sampling_thread;
+ std::thread _sampling_thread;
signals:
void capture_state_changed(int state);
#include <pv/data/logicsnapshot.h>
#include <pv/view/signal.h>
-using boost::mutex;
-using boost::thread;
-using boost::lock_guard;
using std::deque;
using std::dynamic_pointer_cast;
+using std::lock_guard;
using std::make_pair;
using std::min;
+using std::mutex;
using std::pair;
using std::set;
using std::shared_ptr;
using std::string;
+using std::thread;
using std::vector;
namespace pv {
const SigSession &session) :
_file_name(file_name),
_session(session),
+ _interrupt(false),
_units_stored(0),
_unit_count(0)
{
free(probes[i]);
delete[] probes;
- _thread = boost::thread(&StoreSession::store_proc, this, snapshot);
+ _thread = std::thread(&StoreSession::store_proc, this, snapshot);
return true;
}
void StoreSession::cancel()
{
- _thread.interrupt();
+ _interrupt = true;
}
void StoreSession::store_proc(shared_ptr<data::LogicSnapshot> snapshot)
const unsigned int samples_per_block = BlockSize / unit_size;
- while (!boost::this_thread::interruption_requested() &&
- start_sample < _unit_count)
+ while (!_interrupt && start_sample < _unit_count)
{
progress_updated();
#include <stdint.h>
+#include <atomic>
+#include <mutex>
#include <string>
-
-#include <boost/thread.hpp>
+#include <thread>
#include <QObject>
const std::string _file_name;
const SigSession &_session;
- boost::thread _thread;
+ std::thread _thread;
+
+ std::atomic<bool> _interrupt;
- mutable boost::mutex _mutex;
+ mutable std::mutex _mutex;
uint64_t _units_stored;
uint64_t _unit_count;
QString _error;
#include <extdef.h>
-#include <math.h>
+#include <cassert>
+#include <cmath>
#include "analogsignal.h"
#include "pv/data/analog.h"