aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClayton Smith <argilo at gmail.com>2020-08-02 23:52:10 +0200
committerEric Wild <ewild@sysmocom.de>2020-08-02 23:52:25 +0200
commit52fcb0935f22f7abbbb582c9a757ac9b10ae95a4 (patch)
treeb13e77903321cb05861e10130d6cd11941e9c043
parent49f9b2df2a2126ead28a958ebf04f2a0822adbe0 (diff)
A lot of Boost functionality is available in C++11. Since GNU Radio is moving away from Boost, it probably makes sense to do so in gr-osmosdr as well.
This change removes all usage of boost::mutex, boost::mutex::scoped_lock, boost::unique_lock, and boost::condition_variable. It also removes usage of boost::shared_ptr and boost::weak_ptr outside of block definitions (which must continue to use Boost until GNU Radio 3.9). Signed-off-by: Eric Wild <ewild@sysmocom.de>
-rw-r--r--include/osmosdr/pimpl.h6
-rw-r--r--lib/airspy/airspy_source_c.cc2
-rw-r--r--lib/airspy/airspy_source_c.h9
-rw-r--r--lib/airspyhf/airspyhf_source_c.cc2
-rw-r--r--lib/airspyhf/airspyhf_source_c.h9
-rw-r--r--lib/bladerf/bladerf_common.cc15
-rw-r--r--lib/bladerf/bladerf_common.h11
-rw-r--r--lib/device.cc6
-rw-r--r--lib/freesrp/freesrp_common.cc3
-rw-r--r--lib/freesrp/freesrp_common.h3
-rw-r--r--lib/hackrf/hackrf_sink_c.cc4
-rw-r--r--lib/hackrf/hackrf_source_c.cc4
-rw-r--r--lib/miri/miri_source_c.cc6
-rw-r--r--lib/miri/miri_source_c.h9
-rw-r--r--lib/osmosdr/osmosdr_src_c.cc6
-rw-r--r--lib/osmosdr/osmosdr_src_c.h9
-rw-r--r--lib/rfspace/rfspace_source_c.cc6
-rw-r--r--lib/rfspace/rfspace_source_c.h15
-rw-r--r--lib/rtl/rtl_source_c.cc6
-rw-r--r--lib/rtl/rtl_source_c.h9
-rw-r--r--lib/sdrplay/sdrplay_source_c.h7
-rw-r--r--lib/soapy/soapy_common.cc4
-rw-r--r--lib/soapy/soapy_common.h5
-rw-r--r--lib/soapy/soapy_sink_c.cc4
-rw-r--r--lib/soapy/soapy_source_c.cc4
25 files changed, 85 insertions, 79 deletions
diff --git a/include/osmosdr/pimpl.h b/include/osmosdr/pimpl.h
index e1985b4..3a99994 100644
--- a/include/osmosdr/pimpl.h
+++ b/include/osmosdr/pimpl.h
@@ -18,7 +18,7 @@
#ifndef INCLUDED_OSMOSDR_PIMPL_H
#define INCLUDED_OSMOSDR_PIMPL_H
-#include <boost/shared_ptr.hpp>
+#include <memory>
/*! \file pimpl.h
* "Pimpl idiom" (pointer to implementation idiom).
@@ -39,7 +39,7 @@
* \param _name the name of the pimpl class
*/
#define OSMOSDR_PIMPL_DECL(_name) \
- struct _name; boost::shared_ptr<_name>
+ struct _name; std::shared_ptr<_name>
/*!
* Make an instance of a pimpl in a source file.
@@ -49,6 +49,6 @@
* \param _args the constructor args for the pimpl
*/
#define OSMOSDR_PIMPL_MAKE(_name, _args) \
- boost::shared_ptr<_name>(new _name _args)
+ std::shared_ptr<_name>(new _name _args)
#endif /* INCLUDED_OSMOSDR_PIMPL_H */
diff --git a/lib/airspy/airspy_source_c.cc b/lib/airspy/airspy_source_c.cc
index 50150e5..af578d0 100644
--- a/lib/airspy/airspy_source_c.cc
+++ b/lib/airspy/airspy_source_c.cc
@@ -291,7 +291,7 @@ int airspy_source_c::work( int noutput_items,
if ( ! running )
return WORK_DONE;
- boost::unique_lock<boost::mutex> lock(_fifo_lock);
+ std::unique_lock<std::mutex> lock(_fifo_lock);
/* Wait until we have the requested number of samples */
int n_samples_avail = _fifo->size();
diff --git a/lib/airspy/airspy_source_c.h b/lib/airspy/airspy_source_c.h
index f8617e6..a7d817f 100644
--- a/lib/airspy/airspy_source_c.h
+++ b/lib/airspy/airspy_source_c.h
@@ -23,8 +23,9 @@
#define INCLUDED_AIRSPY_SOURCE_C_H
#include <boost/circular_buffer.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include <gnuradio/sync_block.h>
@@ -128,8 +129,8 @@ private:
airspy_device *_dev;
boost::circular_buffer<gr_complex> *_fifo;
- boost::mutex _fifo_lock;
- boost::condition_variable _samp_avail;
+ std::mutex _fifo_lock;
+ std::condition_variable _samp_avail;
std::vector< std::pair<double, uint32_t> > _sample_rates;
double _sample_rate;
diff --git a/lib/airspyhf/airspyhf_source_c.cc b/lib/airspyhf/airspyhf_source_c.cc
index 327fe19..f90b60b 100644
--- a/lib/airspyhf/airspyhf_source_c.cc
+++ b/lib/airspyhf/airspyhf_source_c.cc
@@ -239,7 +239,7 @@ int airspyhf_source_c::work( int noutput_items,
if ( ! running )
return WORK_DONE;
- boost::unique_lock<boost::mutex> lock(_fifo_lock);
+ std::unique_lock<std::mutex> lock(_fifo_lock);
/* Wait until we have the requested number of samples */
int n_samples_avail = _fifo->size();
diff --git a/lib/airspyhf/airspyhf_source_c.h b/lib/airspyhf/airspyhf_source_c.h
index cfb8c89..dbdd87a 100644
--- a/lib/airspyhf/airspyhf_source_c.h
+++ b/lib/airspyhf/airspyhf_source_c.h
@@ -23,8 +23,9 @@
#define INCLUDED_AIRSPYHF_SOURCE_C_H
#include <boost/circular_buffer.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include <gnuradio/sync_block.h>
@@ -105,8 +106,8 @@ private:
airspyhf_device *_dev;
boost::circular_buffer<gr_complex> *_fifo;
- boost::mutex _fifo_lock;
- boost::condition_variable _samp_avail;
+ std::mutex _fifo_lock;
+ std::condition_variable _samp_avail;
std::vector< std::pair<double, uint32_t> > _sample_rates;
double _sample_rate;
diff --git a/lib/bladerf/bladerf_common.cc b/lib/bladerf/bladerf_common.cc
index 4327d44..19b8a02 100644
--- a/lib/bladerf/bladerf_common.cc
+++ b/lib/bladerf/bladerf_common.cc
@@ -38,7 +38,6 @@
#include <boost/foreach.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
-#include <boost/weak_ptr.hpp>
#include "bladerf_common.h"
@@ -50,8 +49,8 @@ static size_t const STREAM_TIMEOUT_MS = 3000;
using namespace boost::assign;
-boost::mutex bladerf_common::_devs_mutex;
-std::list<boost::weak_ptr<struct bladerf>> bladerf_common::_devs;
+std::mutex bladerf_common::_devs_mutex;
+std::list<std::weak_ptr<struct bladerf>> bladerf_common::_devs;
/* name for system-wide gain (which is not its own libbladeRF gain stage) */
static const char *SYSTEM_GAIN_NAME = "system";
@@ -1079,7 +1078,7 @@ bladerf_sptr bladerf_common::open(std::string const &device_name)
struct bladerf *raw_dev = NULL;
struct bladerf_devinfo devinfo;
- boost::unique_lock<boost::mutex> lock(_devs_mutex);
+ std::lock_guard<std::mutex> lock(_devs_mutex);
/* Initialize the information used to identify the desired device
* to all wildcard (i.e., "any device") values */
@@ -1109,15 +1108,15 @@ bladerf_sptr bladerf_common::open(std::string const &device_name)
/* Add the device handle to our cache */
bladerf_sptr dev = bladerf_sptr(raw_dev, bladerf_common::close);
- _devs.push_back(static_cast<boost::weak_ptr<struct bladerf>>(dev));
+ _devs.push_back(static_cast<std::weak_ptr<struct bladerf>>(dev));
return dev;
}
void bladerf_common::close(void *dev)
{
- boost::unique_lock<boost::mutex> lock(_devs_mutex);
- std::list<boost::weak_ptr<struct bladerf>>::iterator it(_devs.begin());
+ std::lock_guard<std::mutex> lock(_devs_mutex);
+ std::list<std::weak_ptr<struct bladerf>>::iterator it(_devs.begin());
/* Prune expired entries from device cache */
while (it != _devs.end()) {
@@ -1137,7 +1136,7 @@ bladerf_sptr bladerf_common::get_cached_device(struct bladerf_devinfo devinfo)
int status;
struct bladerf_devinfo other_devinfo;
- BOOST_FOREACH(boost::weak_ptr<struct bladerf> dev, _devs) {
+ BOOST_FOREACH(std::weak_ptr<struct bladerf> dev, _devs) {
status = bladerf_get_devinfo(bladerf_sptr(dev).get(), &other_devinfo);
if (status < 0) {
BLADERF_THROW_STATUS(status, "Failed to get devinfo for cached device");
diff --git a/lib/bladerf/bladerf_common.h b/lib/bladerf/bladerf_common.h
index 27afa83..741b1e7 100644
--- a/lib/bladerf/bladerf_common.h
+++ b/lib/bladerf/bladerf_common.h
@@ -23,12 +23,11 @@
#include <list>
#include <map>
+#include <memory>
+#include <mutex>
#include <string>
#include <vector>
-#include <boost/thread/mutex.hpp>
-#include <boost/weak_ptr.hpp>
-
#include <libbladeRF.h>
#include "osmosdr/ranges.h"
@@ -43,7 +42,7 @@ typedef ptrdiff_t ssize_t;
#define BLADERF_DEBUG_ENABLE
-typedef boost::shared_ptr<struct bladerf> bladerf_sptr;
+typedef std::shared_ptr<struct bladerf> bladerf_sptr;
/* Identification of the bladeRF hardware in use */
typedef enum {
@@ -287,8 +286,8 @@ private:
/*****************************************************************************
* Private members
****************************************************************************/
- static boost::mutex _devs_mutex; /**< mutex for access to _devs */
- static std::list<boost::weak_ptr<struct bladerf>> _devs; /**< dev cache */
+ static std::mutex _devs_mutex; /**< mutex for access to _devs */
+ static std::list<std::weak_ptr<struct bladerf>> _devs; /**< dev cache */
};
#endif
diff --git a/lib/device.cc b/lib/device.cc
index 586062f..015383d 100644
--- a/lib/device.cc
+++ b/lib/device.cc
@@ -22,8 +22,8 @@
#include <stdexcept>
#include <boost/foreach.hpp>
#include <boost/format.hpp>
-#include <boost/thread/mutex.hpp>
#include <algorithm>
+#include <mutex>
#include <sstream>
#ifdef HAVE_CONFIG_H
@@ -102,7 +102,7 @@ static const std::string args_delim = " ";
static const std::string pairs_delim = ",";
static const std::string pair_delim = "=";
-static boost::mutex _device_mutex;
+static std::mutex _device_mutex;
device_t::device_t(const std::string &args)
{
@@ -141,7 +141,7 @@ std::string device_t::to_string(void) const
devices_t device::find(const device_t &hint)
{
- boost::mutex::scoped_lock lock(_device_mutex);
+ std::lock_guard<std::mutex> lock(_device_mutex);
bool fake = true;
diff --git a/lib/freesrp/freesrp_common.cc b/lib/freesrp/freesrp_common.cc
index d60fbb8..57bbdbb 100644
--- a/lib/freesrp/freesrp_common.cc
+++ b/lib/freesrp/freesrp_common.cc
@@ -2,7 +2,6 @@
#include <cstdlib>
-#include <boost/make_shared.hpp>
#include <boost/assign.hpp>
#include <arg_helpers.h>
@@ -11,7 +10,7 @@ using namespace FreeSRP;
using namespace std;
using namespace boost::assign;
-boost::shared_ptr<::FreeSRP::FreeSRP> freesrp_common::_srp;
+std::shared_ptr<::FreeSRP::FreeSRP> freesrp_common::_srp;
freesrp_common::freesrp_common(const string &args)
{
diff --git a/lib/freesrp/freesrp_common.h b/lib/freesrp/freesrp_common.h
index 9a5687c..8d13c47 100644
--- a/lib/freesrp/freesrp_common.h
+++ b/lib/freesrp/freesrp_common.h
@@ -1,6 +1,7 @@
#ifndef INCLUDED_FREESRP_COMMON_H
#define INCLUDED_FREESRP_COMMON_H
+#include <memory>
#include <vector>
#include <string>
@@ -22,7 +23,7 @@ public:
double set_freq_corr( double ppm, size_t chan = 0 );
double get_freq_corr( size_t chan = 0 );
protected:
- static boost::shared_ptr<::FreeSRP::FreeSRP> _srp;
+ static std::shared_ptr<::FreeSRP::FreeSRP> _srp;
bool _ignore_overflow = false;
};
diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc
index 7271109..1762934 100644
--- a/lib/hackrf/hackrf_sink_c.cc
+++ b/lib/hackrf/hackrf_sink_c.cc
@@ -196,7 +196,7 @@ int hackrf_sink_c::hackrf_tx_callback(unsigned char *buffer, uint32_t length)
*buffer++ = rand() % 255;
#else
{
- std::unique_lock<std::mutex> lock(_buf_mutex);
+ std::lock_guard<std::mutex> lock(_buf_mutex);
if ( ! cb_pop_front( &_cbuf, buffer ) ) {
memset(buffer, 0, length);
@@ -372,7 +372,7 @@ int hackrf_sink_c::work( int noutput_items,
if((unsigned int)noutput_items >= remaining) {
{
- std::unique_lock<std::mutex> lock(_buf_mutex);
+ std::lock_guard<std::mutex> lock(_buf_mutex);
if ( ! cb_push_back( &_cbuf, _buf ) ) {
_buf_used = prev_buf_used;
diff --git a/lib/hackrf/hackrf_source_c.cc b/lib/hackrf/hackrf_source_c.cc
index eea5caa..0c0ae21 100644
--- a/lib/hackrf/hackrf_source_c.cc
+++ b/lib/hackrf/hackrf_source_c.cc
@@ -151,7 +151,7 @@ int hackrf_source_c::_hackrf_rx_callback(hackrf_transfer *transfer)
int hackrf_source_c::hackrf_rx_callback(unsigned char *buf, uint32_t len)
{
{
- std::unique_lock<std::mutex> lock(_buf_mutex);
+ std::lock_guard<std::mutex> lock(_buf_mutex);
int buf_tail = (_buf_head + _buf_used) % _buf_num;
memcpy(_buf[buf_tail], buf, len);
@@ -231,7 +231,7 @@ int hackrf_source_c::work( int noutput_items,
*out++ = _lut[ *(buf + i) ];
{
- std::unique_lock<std::mutex> lock(_buf_mutex);
+ std::lock_guard<std::mutex> lock(_buf_mutex);
_buf_head = (_buf_head + 1) % _buf_num;
_buf_used--;
diff --git a/lib/miri/miri_source_c.cc b/lib/miri/miri_source_c.cc
index c9f81fa..c1b9428 100644
--- a/lib/miri/miri_source_c.cc
+++ b/lib/miri/miri_source_c.cc
@@ -182,7 +182,7 @@ void miri_source_c::mirisdr_callback(unsigned char *buf, uint32_t len)
}
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
if (len > BUF_SIZE)
throw std::runtime_error("Buffer too small.");
@@ -226,7 +226,7 @@ int miri_source_c::work( int noutput_items,
gr_complex *out = (gr_complex *)output_items[0];
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::unique_lock<std::mutex> lock( _buf_mutex );
while (_buf_used < 3 && _running) // collect at least 3 buffers
_buf_cond.wait( lock );
@@ -250,7 +250,7 @@ int miri_source_c::work( int noutput_items,
float(*(buf + i * 2 + 1)) * (1.0f/4096.0f) );
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
_buf_head = (_buf_head + 1) % _buf_num;
_buf_used--;
diff --git a/lib/miri/miri_source_c.h b/lib/miri/miri_source_c.h
index 5363db5..1ea906f 100644
--- a/lib/miri/miri_source_c.h
+++ b/lib/miri/miri_source_c.h
@@ -23,8 +23,9 @@
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include "source_iface.h"
@@ -120,8 +121,8 @@ private:
unsigned int _buf_num;
unsigned int _buf_head;
unsigned int _buf_used;
- boost::mutex _buf_mutex;
- boost::condition_variable _buf_cond;
+ std::mutex _buf_mutex;
+ std::condition_variable _buf_cond;
bool _running;
unsigned int _buf_offset;
diff --git a/lib/osmosdr/osmosdr_src_c.cc b/lib/osmosdr/osmosdr_src_c.cc
index de65373..e4f8b89 100644
--- a/lib/osmosdr/osmosdr_src_c.cc
+++ b/lib/osmosdr/osmosdr_src_c.cc
@@ -179,7 +179,7 @@ void osmosdr_src_c::osmosdr_callback(unsigned char *buf, uint32_t len)
}
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
int buf_tail = (_buf_head + _buf_used) % _buf_num;
memcpy(_buf[buf_tail], buf, len);
@@ -219,7 +219,7 @@ int osmosdr_src_c::work( int noutput_items,
gr_complex *out = (gr_complex *)output_items[0];
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::unique_lock<std::mutex> lock( _buf_mutex );
while (_buf_used < 3 && _running) // collect at least 3 buffers
_buf_cond.wait( lock );
@@ -243,7 +243,7 @@ int osmosdr_src_c::work( int noutput_items,
float(*(buf + i * 2 + 1)) * (1.0f/32767.5f) );
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
_buf_head = (_buf_head + 1) % _buf_num;
_buf_used--;
diff --git a/lib/osmosdr/osmosdr_src_c.h b/lib/osmosdr/osmosdr_src_c.h
index 0f62b09..f8f18ec 100644
--- a/lib/osmosdr/osmosdr_src_c.h
+++ b/lib/osmosdr/osmosdr_src_c.h
@@ -23,8 +23,9 @@
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include "source_iface.h"
@@ -124,8 +125,8 @@ private:
unsigned int _buf_len;
unsigned int _buf_head;
unsigned int _buf_used;
- boost::mutex _buf_mutex;
- boost::condition_variable _buf_cond;
+ std::mutex _buf_mutex;
+ std::condition_variable _buf_cond;
bool _running;
unsigned int _buf_offset;
diff --git a/lib/rfspace/rfspace_source_c.cc b/lib/rfspace/rfspace_source_c.cc
index 80f34df..121dcde 100644
--- a/lib/rfspace/rfspace_source_c.cc
+++ b/lib/rfspace/rfspace_source_c.cc
@@ -590,7 +590,7 @@ bool rfspace_source_c::transaction( const unsigned char *cmd, size_t size,
if ( write(_usb, cmd, size) != (int)size )
return false;
- boost::unique_lock<boost::mutex> lock(_resp_lock);
+ std::unique_lock<std::mutex> lock(_resp_lock);
_resp_avail.wait(lock);
rx_bytes = _resp.size();
@@ -598,7 +598,7 @@ bool rfspace_source_c::transaction( const unsigned char *cmd, size_t size,
}
else
{
- boost::mutex::scoped_lock lock(_tcp_lock);
+ std::lock_guard<std::mutex> lock(_tcp_lock);
#ifdef USE_ASIO
_t.write_some( boost::asio::buffer(cmd, size) );
@@ -829,7 +829,7 @@ int rfspace_source_c::work( int noutput_items,
{
gr_complex *out = (gr_complex *)output_items[0];
- boost::unique_lock<boost::mutex> lock(_fifo_lock);
+ std::unique_lock<std::mutex> lock(_fifo_lock);
/* Wait until we have the requested number of samples */
int n_samples_avail = _fifo->size();
diff --git a/lib/rfspace/rfspace_source_c.h b/lib/rfspace/rfspace_source_c.h
index c656063..a51bfc6 100644
--- a/lib/rfspace/rfspace_source_c.h
+++ b/lib/rfspace/rfspace_source_c.h
@@ -30,8 +30,9 @@
#include <gnuradio/sync_block.h>
#include <boost/circular_buffer.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include "osmosdr/ranges.h"
#include "source_iface.h"
@@ -164,15 +165,15 @@ private: /* members */
gr::thread::thread _thread;
bool _run_usb_read_task;
bool _run_tcp_keepalive_task;
- boost::mutex _tcp_lock;
+ std::mutex _tcp_lock;
boost::circular_buffer<gr_complex> *_fifo;
- boost::mutex _fifo_lock;
- boost::condition_variable _samp_avail;
+ std::mutex _fifo_lock;
+ std::condition_variable _samp_avail;
std::vector< unsigned char > _resp;
- boost::mutex _resp_lock;
- boost::condition_variable _resp_avail;
+ std::mutex _resp_lock;
+ std::condition_variable _resp_avail;
};
#endif /* INCLUDED_RFSPACE_SOURCE_C_H */
diff --git a/lib/rtl/rtl_source_c.cc b/lib/rtl/rtl_source_c.cc
index a371464..e312ed7 100644
--- a/lib/rtl/rtl_source_c.cc
+++ b/lib/rtl/rtl_source_c.cc
@@ -298,7 +298,7 @@ void rtl_source_c::rtlsdr_callback(unsigned char *buf, uint32_t len)
}
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
int buf_tail = (_buf_head + _buf_used) % _buf_num;
memcpy(_buf[buf_tail], buf, len);
@@ -338,7 +338,7 @@ int rtl_source_c::work( int noutput_items,
gr_complex *out = (gr_complex *)output_items[0];
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::unique_lock<std::mutex> lock( _buf_mutex );
while (_buf_used < 3 && _running) // collect at least 3 buffers
_buf_cond.wait( lock );
@@ -359,7 +359,7 @@ int rtl_source_c::work( int noutput_items,
if (!_samp_avail) {
{
- boost::mutex::scoped_lock lock( _buf_mutex );
+ std::lock_guard<std::mutex> lock( _buf_mutex );
_buf_head = (_buf_head + 1) % _buf_num;
_buf_used--;
diff --git a/lib/rtl/rtl_source_c.h b/lib/rtl/rtl_source_c.h
index 902b386..de3e349 100644
--- a/lib/rtl/rtl_source_c.h
+++ b/lib/rtl/rtl_source_c.h
@@ -25,8 +25,9 @@
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include "source_iface.h"
@@ -131,8 +132,8 @@ private:
unsigned int _buf_len;
unsigned int _buf_head;
unsigned int _buf_used;
- boost::mutex _buf_mutex;
- boost::condition_variable _buf_cond;
+ std::mutex _buf_mutex;
+ std::condition_variable _buf_cond;
bool _running;
unsigned int _buf_offset;
diff --git a/lib/sdrplay/sdrplay_source_c.h b/lib/sdrplay/sdrplay_source_c.h
index 2e4631e..b59f44a 100644
--- a/lib/sdrplay/sdrplay_source_c.h
+++ b/lib/sdrplay/sdrplay_source_c.h
@@ -24,8 +24,9 @@
#include <gnuradio/sync_block.h>
#include <gnuradio/thread/thread.h>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/condition_variable.hpp>
+
+#include <mutex>
+#include <condition_variable>
#include "osmosdr/ranges.h"
@@ -126,7 +127,7 @@ private:
std::vector< short > _bufi;
std::vector< short > _bufq;
int _buf_offset;
- boost::mutex _buf_mutex;
+ std::mutex _buf_mutex;
bool _running;
bool _uninit;
diff --git a/lib/soapy/soapy_common.cc b/lib/soapy/soapy_common.cc
index 0e277e4..e241967 100644
--- a/lib/soapy/soapy_common.cc
+++ b/lib/soapy/soapy_common.cc
@@ -36,8 +36,8 @@ osmosdr::gain_range_t soapy_range_to_gain_range(const SoapySDR::Range &r)
return osmosdr::gain_range_t(r.minimum(), r.maximum(), step);
}
-boost::mutex &get_soapy_maker_mutex(void)
+std::mutex &get_soapy_maker_mutex(void)
{
- static boost::mutex m;
+ static std::mutex m;
return m;
}
diff --git a/lib/soapy/soapy_common.h b/lib/soapy/soapy_common.h
index 87e46a5..8adb0db 100644
--- a/lib/soapy/soapy_common.h
+++ b/lib/soapy/soapy_common.h
@@ -23,7 +23,8 @@
#include <osmosdr/ranges.h>
#include <SoapySDR/Types.hpp>
-#include <boost/thread/mutex.hpp>
+
+#include <mutex>
/*!
* Convert a soapy range to a gain range.
@@ -35,6 +36,6 @@ osmosdr::gain_range_t soapy_range_to_gain_range(const SoapySDR::Range &r);
* Global mutex to protect factory routines.
* (optional under 0.5 release above)
*/
-boost::mutex &get_soapy_maker_mutex(void);
+std::mutex &get_soapy_maker_mutex(void);
#endif /* INCLUDED_SOAPY_COMMON_H */
diff --git a/lib/soapy/soapy_sink_c.cc b/lib/soapy/soapy_sink_c.cc
index b12b8da..e4422f7 100644
--- a/lib/soapy/soapy_sink_c.cc
+++ b/lib/soapy/soapy_sink_c.cc
@@ -63,7 +63,7 @@ soapy_sink_c::soapy_sink_c (const std::string &args)
gr::io_signature::make (0, 0, 0))
{
{
- boost::mutex::scoped_lock l(get_soapy_maker_mutex());
+ std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
_device = SoapySDR::Device::make(params_to_dict(args));
}
_nchan = std::max(1, args_to_io_signature(args)->max_streams());
@@ -75,7 +75,7 @@ soapy_sink_c::soapy_sink_c (const std::string &args)
soapy_sink_c::~soapy_sink_c(void)
{
_device->closeStream(_stream);
- boost::mutex::scoped_lock l(get_soapy_maker_mutex());
+ std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
SoapySDR::Device::unmake(_device);
}
diff --git a/lib/soapy/soapy_source_c.cc b/lib/soapy/soapy_source_c.cc
index 5c683c9..4056a50 100644
--- a/lib/soapy/soapy_source_c.cc
+++ b/lib/soapy/soapy_source_c.cc
@@ -64,7 +64,7 @@ soapy_source_c::soapy_source_c (const std::string &args)
args_to_io_signature(args))
{
{
- boost::mutex::scoped_lock l(get_soapy_maker_mutex());
+ std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
_device = SoapySDR::Device::make(params_to_dict(args));
}
_nchan = std::max(1, args_to_io_signature(args)->max_streams());
@@ -76,7 +76,7 @@ soapy_source_c::soapy_source_c (const std::string &args)
soapy_source_c::~soapy_source_c(void)
{
_device->closeStream(_stream);
- boost::mutex::scoped_lock l(get_soapy_maker_mutex());
+ std::lock_guard<std::mutex> l(get_soapy_maker_mutex());
SoapySDR::Device::unmake(_device);
}