forked from sdr/gr-osmosdr
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>gr3.8
parent
49f9b2df2a
commit
52fcb0935f
|
@ -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 */
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue