aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/usrp
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-07-06 16:51:55 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-10-19 12:21:33 -0700
commitb6119e581e6ea9273b188463dc4529c30db140ba (patch)
tree11517bfd9cff0f0e37120b10c72b4387f7d509a6 /host/lib/usrp
parent01d81c7fa5e43210a40c61ce39287c7be245f7c4 (diff)
downloaduhd-b6119e581e6ea9273b188463dc4529c30db140ba.tar.gz
uhd-b6119e581e6ea9273b188463dc4529c30db140ba.tar.bz2
uhd-b6119e581e6ea9273b188463dc4529c30db140ba.zip
uhd: Replace Boost mutexes and locks with standard options
This is a very mechanical task that could almost have been done with sed. Boost versions of mutexes and locks were removed, and replaced with std:: versions. The replacement tables are as follows: == Mutexes == - boost::mutex -> std::mutex - boost::recursive_mutex -> std::recursive_mutex Mutexes behave identically between Boost and std:: and have the same API. == Locks == C++11 has only two types of lock that we use/need in UHD: - std::lock_guard: Identical to boost::lock_guard - std::unique_lock: Identical to boost::unique_lock Boost also has boost::mutex::scoped_lock, which is a typedef for boost::unique_lock<>. However, we often have used scoped_lock where we meant to use lock_guard<>. The name is a bit misleading, "scoped lock" sounding a bit like an RAII mechanism. Therefore, some previous boost::mutex::scoped_lock are now std::lock_guard<>. std::unique_lock is required when doing more than RAII locking (i.e., unlocking, relocking, usage with condition variables, etc.). == Condition Variables == Condition variables were out of the scope of this lock/mutex change, but in UHD, we inconsistently use boost::condition vs. boost::condition_variable. The former is a templated version of the latter, and thus works fine with std::mutex'es. Therefore, some boost::condition_variable where changed to boost::condition. All locks and mutexes use `#include <mutex>`. The corresponding Boost includes were removed. In some cases, this exposed issues with implicit Boost includes elsewhere. The missing explicit includes were added.
Diffstat (limited to 'host/lib/usrp')
-rw-r--r--host/lib/usrp/b100/usb_zero_copy_wrapper.cpp15
-rw-r--r--host/lib/usrp/b200/b200_radio_ctrl_core.cpp17
-rw-r--r--host/lib/usrp/common/recv_packet_demuxer.cpp6
-rw-r--r--host/lib/usrp/cores/i2c_core_200.cpp8
-rw-r--r--host/lib/usrp/cores/user_settings_core_3000.cpp8
-rw-r--r--host/lib/usrp/dboard/db_ubx.cpp28
-rw-r--r--host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp52
-rw-r--r--host/lib/usrp/dboard/twinrx/twinrx_io.hpp10
-rw-r--r--host/lib/usrp/gps_ctrl.cpp11
-rw-r--r--host/lib/usrp/usrp1/soft_time_ctrl.cpp22
-rw-r--r--host/lib/usrp/usrp2/io_impl.cpp6
-rw-r--r--host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp20
-rw-r--r--host/lib/usrp/usrp2/usrp2_iface.cpp5
-rw-r--r--host/lib/usrp/usrp_c.cpp38
-rw-r--r--host/lib/usrp/x300/x300_fw_ctrl.cpp10
-rw-r--r--host/lib/usrp/x300/x300_fw_uart.cpp10
16 files changed, 133 insertions, 133 deletions
diff --git a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp
index b2348c3a9..7596b47be 100644
--- a/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp
+++ b/host/lib/usrp/b100/usb_zero_copy_wrapper.cpp
@@ -11,11 +11,10 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/tasks.hpp>
#include <uhdlib/utils/atomic.hpp>
-#include <boost/thread/condition_variable.hpp>
-#include <boost/thread/mutex.hpp>
+#include <boost/thread/condition.hpp>
#include <functional>
-#include <iostream>
#include <memory>
+#include <mutex>
#include <vector>
using namespace uhd;
@@ -98,7 +97,7 @@ public:
void release(void) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::unique_lock<std::mutex> lock(_mutex);
_ok_to_auto_flush = true;
// get a reference to the VITA header before incrementing
@@ -124,7 +123,7 @@ public:
UHD_INLINE sptr get_new(const double timeout)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_ok_to_auto_flush = false;
if (not _last_send_buff) {
@@ -146,8 +145,8 @@ private:
char* _mem_buffer_tip;
// private variables for auto flusher
- boost::mutex _mutex;
- boost::condition_variable _cond;
+ std::mutex _mutex;
+ boost::condition _cond;
uhd::task::sptr _task;
bool _ok_to_auto_flush;
@@ -157,7 +156,7 @@ private:
*/
void auto_flush(void)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::unique_lock<std::mutex> lock(_mutex);
const bool timeout = not _cond.timed_wait(lock, AUTOFLUSH_TIMEOUT);
if (timeout and _ok_to_auto_flush and _last_send_buff and _bytes_in_buffer != 0) {
_last_send_buff->commit(_bytes_in_buffer);
diff --git a/host/lib/usrp/b200/b200_radio_ctrl_core.cpp b/host/lib/usrp/b200/b200_radio_ctrl_core.cpp
index e885bf1b6..7a730b1fa 100644
--- a/host/lib/usrp/b200/b200_radio_ctrl_core.cpp
+++ b/host/lib/usrp/b200/b200_radio_ctrl_core.cpp
@@ -14,9 +14,8 @@
#include <uhd/utils/safe_call.hpp>
#include <uhdlib/usrp/common/async_packet_handler.hpp>
#include <boost/format.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
#include <functional>
+#include <mutex>
#include <queue>
using namespace uhd;
@@ -74,14 +73,14 @@ public:
******************************************************************/
void poke32(const wb_addr_type addr, const uint32_t data) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt(addr / 4, data);
this->wait_for_ack(false);
}
uint32_t peek32(const wb_addr_type addr) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt(SR_READBACK, addr / 8);
const uint64_t res = this->wait_for_ack(true);
const uint32_t lo = uint32_t(res & 0xffffffff);
@@ -91,7 +90,7 @@ public:
uint64_t peek64(const wb_addr_type addr) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt(SR_READBACK, addr / 8);
return this->wait_for_ack(true);
}
@@ -101,7 +100,7 @@ public:
******************************************************************/
void set_time(const uhd::time_spec_t& time) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_time = time;
_use_time = _time != uhd::time_spec_t(0.0);
if (_use_time)
@@ -110,13 +109,13 @@ public:
uhd::time_spec_t get_time(void) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
return _time;
}
void set_tick_rate(const double rate) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_tick_rate = rate;
}
@@ -327,7 +326,7 @@ private:
uhd::msg_task::sptr _async_task;
const uint32_t _sid;
const std::string _name;
- boost::mutex _mutex;
+ std::mutex _mutex;
size_t _seq_out;
uhd::time_spec_t _time;
bool _use_time;
diff --git a/host/lib/usrp/common/recv_packet_demuxer.cpp b/host/lib/usrp/common/recv_packet_demuxer.cpp
index 9d3067286..9270a40bf 100644
--- a/host/lib/usrp/common/recv_packet_demuxer.cpp
+++ b/host/lib/usrp/common/recv_packet_demuxer.cpp
@@ -10,8 +10,8 @@
#include <uhd/utils/byteswap.hpp>
#include <uhd/utils/log.hpp>
#include <uhdlib/usrp/common/recv_packet_demuxer.hpp>
-#include <boost/thread/mutex.hpp>
#include <deque>
+#include <mutex>
#include <queue>
#include <vector>
@@ -59,7 +59,7 @@ public:
managed_recv_buffer::sptr get_recv_buff(
const size_t index, const double timeout) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
managed_recv_buffer::sptr buff;
// there is already an entry in the queue, so pop that
@@ -104,7 +104,7 @@ public:
private:
transport::zero_copy_if::sptr _transport;
const uint32_t _sid_base;
- boost::mutex _mutex;
+ std::mutex _mutex;
struct channel_guts_type
{
channel_guts_type(void) : wrapper(container) {}
diff --git a/host/lib/usrp/cores/i2c_core_200.cpp b/host/lib/usrp/cores/i2c_core_200.cpp
index 93e3fedf8..fd9332638 100644
--- a/host/lib/usrp/cores/i2c_core_200.cpp
+++ b/host/lib/usrp/cores/i2c_core_200.cpp
@@ -8,8 +8,8 @@
#include <uhd/exception.hpp>
#include <uhd/utils/log.hpp>
#include <uhdlib/usrp/cores/i2c_core_200.hpp>
-#include <boost/thread/mutex.hpp>
#include <chrono>
+#include <mutex>
#include <thread>
#define REG_I2C_WR_PRESCALER_LO (1 << 3) | 0
@@ -137,13 +137,13 @@ private:
void poke(const size_t what, const uint8_t cmd)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_iface->poke32(_base, (what << 8) | cmd);
}
uint8_t peek(const size_t what)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_iface->poke32(_base, what << 8);
return uint8_t(_iface->peek32(_readback));
}
@@ -151,7 +151,7 @@ private:
wb_iface::sptr _iface;
const size_t _base;
const size_t _readback;
- boost::mutex _mutex;
+ std::mutex _mutex;
};
i2c_core_200::sptr i2c_core_200::make(
diff --git a/host/lib/usrp/cores/user_settings_core_3000.cpp b/host/lib/usrp/cores/user_settings_core_3000.cpp
index 9e04175c2..7293f9070 100644
--- a/host/lib/usrp/cores/user_settings_core_3000.cpp
+++ b/host/lib/usrp/cores/user_settings_core_3000.cpp
@@ -7,7 +7,7 @@
#include <uhd/exception.hpp>
#include <uhdlib/usrp/cores/user_settings_core_3000.hpp>
-#include <boost/thread/thread.hpp>
+#include <mutex>
using namespace uhd;
@@ -38,7 +38,7 @@ public:
if (offset % sizeof(uint64_t) != 0)
throw uhd::value_error("peek64: Incorrect address alignment");
- boost::unique_lock<boost::mutex> lock(_mutex);
+ std::unique_lock<std::mutex> lock(_mutex);
_iface->poke32(
REG_USER_RB_ADDR, offset >> 3); // Translate byte offset to 64-bit offset
return _iface->peek64(_rb_reg_addr);
@@ -49,7 +49,7 @@ public:
if (offset % sizeof(uint32_t) != 0)
throw uhd::value_error("poke32: Incorrect address alignment");
- boost::unique_lock<boost::mutex> lock(_mutex);
+ std::unique_lock<std::mutex> lock(_mutex);
_iface->poke32(
REG_USER_SR_ADDR, offset >> 2); // Translate byte offset to 64-bit offset
_iface->poke32(REG_USER_SR_DATA, value);
@@ -72,7 +72,7 @@ private:
wb_iface::sptr _iface;
const wb_addr_type _sr_base_addr;
const wb_addr_type _rb_reg_addr;
- boost::mutex _mutex;
+ std::mutex _mutex;
};
wb_iface::sptr user_settings_core_3000::make(
diff --git a/host/lib/usrp/dboard/db_ubx.cpp b/host/lib/usrp/dboard/db_ubx.cpp
index d36347b86..56d73bdab 100644
--- a/host/lib/usrp/dboard/db_ubx.cpp
+++ b/host/lib/usrp/dboard/db_ubx.cpp
@@ -21,12 +21,12 @@
#include <uhd/utils/static.hpp>
#include <uhdlib/usrp/common/max287x.hpp>
#include <boost/algorithm/string.hpp>
-#include <boost/math/special_functions/round.hpp>
-#include <boost/thread/mutex.hpp>
+#include <boost/format.hpp>
#include <chrono>
#include <functional>
#include <map>
#include <memory>
+#include <mutex>
#include <thread>
using namespace uhd;
@@ -595,14 +595,14 @@ private:
**********************************************************************/
void write_spi_reg(spi_dest_t dest, uint32_t value)
{
- boost::mutex::scoped_lock lock(_spi_mutex);
+ std::lock_guard<std::mutex> lock(_spi_mutex);
ROUTE_SPI(_iface, dest);
WRITE_SPI(_iface, value);
}
void write_spi_regs(spi_dest_t dest, std::vector<uint32_t> values)
{
- boost::mutex::scoped_lock lock(_spi_mutex);
+ std::lock_guard<std::mutex> lock(_spi_mutex);
ROUTE_SPI(_iface, dest);
for (uint32_t value : values)
WRITE_SPI(_iface, value);
@@ -759,7 +759,7 @@ private:
**********************************************************************/
sensor_value_t get_locked(const std::string& pll_name)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
assert_has(ubx_plls, pll_name, "ubx pll name");
if (pll_name == "TXLO") {
@@ -785,7 +785,7 @@ private:
// Set RX antennas
std::string set_rx_ant(const std::string& ant)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
// validate input
assert_has(ubx_rx_antennas, ant, "ubx rx antenna name");
@@ -819,7 +819,7 @@ private:
**********************************************************************/
double set_tx_gain(double gain)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
gain = ubx_tx_gain_range.clip(gain);
int attn_code = int(std::floor(gain * 2));
_ubx_tx_atten_val = ((attn_code & 0x3F) << 10);
@@ -834,7 +834,7 @@ private:
double set_rx_gain(double gain)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
gain = ubx_rx_gain_range.clip(gain);
int attn_code = int(std::floor(gain * 2));
_ubx_rx_atten_val = ((attn_code & 0x3F) << 10);
@@ -852,7 +852,7 @@ private:
**********************************************************************/
double set_tx_freq(double freq)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double freq_lo1 = 0.0;
double freq_lo2 = 0.0;
double ref_freq = _iface->get_clock_rate(dboard_iface::UNIT_TX);
@@ -1000,7 +1000,7 @@ private:
double set_rx_freq(double freq)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double freq_lo1 = 0.0;
double freq_lo2 = 0.0;
double ref_freq = _iface->get_clock_rate(dboard_iface::UNIT_RX);
@@ -1186,7 +1186,7 @@ private:
**********************************************************************/
void set_power_mode(std::string mode)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (mode == "performance") {
// performance mode attempts to reduce tuning and settling time
// as much as possible without adding noise.
@@ -1292,7 +1292,7 @@ private:
}
}();
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
for (const auto& lo : {_txlo1, _txlo2, _rxlo1, _rxlo2}) {
lo->set_auto_retune(enabled);
}
@@ -1302,8 +1302,8 @@ private:
* Variables
**********************************************************************/
dboard_iface::sptr _iface;
- boost::mutex _spi_mutex;
- boost::mutex _mutex;
+ std::mutex _spi_mutex;
+ std::mutex _mutex;
ubx_cpld_reg_t _cpld_reg;
uint32_t _prev_cpld_value;
std::map<ubx_gpio_field_id_t, ubx_gpio_field_info_t> _gpio_map;
diff --git a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp
index 29ab194be..355d980ee 100644
--- a/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp
+++ b/host/lib/usrp/dboard/twinrx/twinrx_ctrl.cpp
@@ -12,6 +12,8 @@
#include <uhdlib/usrp/common/adf435x.hpp>
#include <uhdlib/usrp/common/adf535x.hpp>
#include <uhdlib/utils/narrow.hpp>
+#include <boost/chrono.hpp>
+#include <boost/format.hpp>
#include <chrono>
#include <cmath>
#include <thread>
@@ -158,19 +160,19 @@ public:
~twinrx_ctrl_impl() override
{
- UHD_SAFE_CALL(boost::lock_guard<boost::mutex> lock(_mutex);
+ UHD_SAFE_CALL(std::lock_guard<std::mutex> lock(_mutex);
_gpio_iface->set_field(twinrx_gpio::FIELD_SWPS_EN, 0);)
}
void commit() override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_commit();
}
void set_chan_enabled(channel_t ch, bool enabled, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->if0_reg3.set(rm::if0_reg3_t::IF1_IF2_EN_CH1, bool2bin(enabled));
_cpld_regs->if0_reg0.set(rm::if0_reg0_t::AMP_LO2_EN_CH1, bool2bin(enabled));
@@ -191,7 +193,7 @@ public:
void set_preamp1(channel_t ch, preamp_state_t value, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf0_reg1.set(
rm::rf0_reg1_t::SWPA1_CTL_CH1, bool2bin(value == PREAMP_HIGHBAND));
@@ -218,7 +220,7 @@ public:
void set_preamp2(channel_t ch, bool enabled, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf2_reg7.set(
rm::rf2_reg7_t::SWPA4_CTRL_CH1, bool2bin(not enabled));
@@ -236,7 +238,7 @@ public:
void set_lb_preamp_preselector(
channel_t ch, bool enabled, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf0_reg7.set(
rm::rf0_reg7_t::SWPA3_CTRL_CH1, bool2bin(not enabled));
@@ -251,7 +253,7 @@ public:
void set_signal_path(channel_t ch, signal_path_t path, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf2_reg2.set(
rm::rf2_reg2_t::SW11_CTRL_CH1, bool2bin(path == PATH_LOWBAND));
@@ -299,7 +301,7 @@ public:
void set_lb_preselector(
channel_t ch, preselector_path_t path, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
uint32_t sw7val = 0, sw8val = 0;
switch (path) {
case PRESEL_PATH1:
@@ -336,7 +338,7 @@ public:
void set_hb_preselector(
channel_t ch, preselector_path_t path, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
uint32_t sw9ch1val = 0, sw10ch1val = 0, sw9ch2val = 0, sw10ch2val = 0;
switch (path) {
case PRESEL_PATH1:
@@ -380,7 +382,7 @@ public:
void set_input_atten(channel_t ch, uint8_t atten, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf0_reg0.set(rm::rf0_reg0_t::ATTEN_IN_CH1, atten & 0x1F);
}
@@ -393,7 +395,7 @@ public:
void set_lb_atten(channel_t ch, uint8_t atten, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf2_reg0.set(rm::rf2_reg0_t::ATTEN_LB_CH1, atten & 0x1F);
}
@@ -406,7 +408,7 @@ public:
void set_hb_atten(channel_t ch, uint8_t atten, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf1_reg0.set(rm::rf1_reg0_t::ATTEN_HB_CH1, atten & 0x1F);
}
@@ -419,7 +421,7 @@ public:
void set_lo1_source(channel_t ch, lo_source_t source, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->rf1_reg5.set(
rm::rf1_reg5_t::SW14_CTRL_CH2, bool2bin(source != LO_COMPANION));
@@ -447,7 +449,7 @@ public:
void set_lo2_source(channel_t ch, lo_source_t source, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (ch == CH1 or ch == BOTH) {
_cpld_regs->if0_reg0.set(
rm::if0_reg0_t::SW19_CTRL_CH2, bool2bin(source == LO_COMPANION));
@@ -472,7 +474,7 @@ public:
void set_lo1_export_source(lo_export_source_t source, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
// SW22 may conflict with the cal switch but this attr takes priority and we
// assume that the cal switch is disabled (by disabling it!)
_set_cal_mode(CAL_DISABLED, source);
@@ -486,7 +488,7 @@ public:
void set_lo2_export_source(lo_export_source_t source, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_cpld_regs->if0_reg7.set(
rm::if0_reg7_t::SW24_CTRL_CH2, bool2bin(source == LO_CH2_SYNTH));
_cpld_regs->if0_reg4.set(
@@ -501,7 +503,7 @@ public:
void set_antenna_mapping(antenna_mapping_t mapping, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
enum switch_path_t { CONNECT, TERM, EXPORT, IMPORT, SWAP };
switch_path_t path1, path2;
@@ -548,7 +550,7 @@ public:
void set_crossover_cal_mode(cal_mode_t cal_mode, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
if (_lo1_export == LO_CH1_SYNTH && cal_mode == CAL_CH2) {
throw uhd::runtime_error(
"cannot enable cal crossover on CH2 when LO1 in CH1 is exported");
@@ -565,7 +567,7 @@ public:
double set_lo1_synth_freq(channel_t ch, double freq, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double coerced_freq = 0.0;
if (ch == CH1 or ch == BOTH) {
@@ -586,7 +588,7 @@ public:
double set_lo2_synth_freq(channel_t ch, double freq, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double coerced_freq = 0.0;
if (ch == CH1 or ch == BOTH) {
@@ -605,7 +607,7 @@ public:
double set_lo1_charge_pump(channel_t ch, double current, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double coerced_current = 0.0;
if (ch == CH1 or ch == BOTH) {
coerced_current =
@@ -624,7 +626,7 @@ public:
double set_lo2_charge_pump(channel_t ch, double current, bool commit = true) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
double coerced_current = 0.0;
if (ch == CH1 or ch == BOTH) {
coerced_current =
@@ -655,7 +657,7 @@ public:
bool read_lo1_locked(channel_t ch) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
bool locked = true;
if (ch == CH1 or ch == BOTH) {
@@ -671,7 +673,7 @@ public:
bool read_lo2_locked(channel_t ch) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
bool locked = true;
if (ch == CH1 or ch == BOTH) {
@@ -851,7 +853,7 @@ private: // Members
}
};
- boost::mutex _mutex;
+ std::mutex _mutex;
dboard_iface::sptr _db_iface;
twinrx_gpio::sptr _gpio_iface;
twinrx_cpld_regmap::sptr _cpld_regs;
diff --git a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp
index 538b0bfa8..5998a87d1 100644
--- a/host/lib/usrp/dboard/twinrx/twinrx_io.hpp
+++ b/host/lib/usrp/dboard/twinrx/twinrx_io.hpp
@@ -12,7 +12,7 @@
#include <uhd/usrp/dboard_base.hpp>
#include <uhd/utils/soft_register.hpp>
#include <uhdlib/usrp/cores/gpio_atr_3000.hpp>
-#include <boost/thread.hpp>
+#include <boost/chrono.hpp>
namespace uhd { namespace usrp { namespace dboard { namespace twinrx {
@@ -95,7 +95,7 @@ public:
void set_field(const uhd::soft_reg_field_t field, const uint32_t value)
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
using namespace soft_reg_field;
_db_iface->set_gpio_out(
@@ -104,7 +104,7 @@ public:
uint32_t get_field(const uhd::soft_reg_field_t field)
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
using namespace soft_reg_field;
return (_db_iface->read_gpio(dboard_iface::UNIT_BOTH) & mask<uint32_t>(field))
>> shift(field);
@@ -113,7 +113,7 @@ public:
// CPLD register write-only interface
void poke32(const wb_addr_type addr, const uint32_t data) override
{
- boost::lock_guard<boost::mutex> lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
using namespace soft_reg_field;
// Step 1: Write the reg offset and data to the GPIO bus and de-assert all enables
@@ -140,7 +140,7 @@ private: // Members/definitions
// Members
dboard_iface::sptr _db_iface;
- boost::mutex _mutex;
+ std::mutex _mutex;
};
class twinrx_cpld_regmap : public uhd::soft_regmap_t
diff --git a/host/lib/usrp/gps_ctrl.cpp b/host/lib/usrp/gps_ctrl.cpp
index bcf938863..cafc2f662 100644
--- a/host/lib/usrp/gps_ctrl.cpp
+++ b/host/lib/usrp/gps_ctrl.cpp
@@ -12,12 +12,13 @@
#include <stdint.h>
#include <boost/algorithm/string.hpp>
#include <boost/date_time.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/format.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
+#include <boost/thread/thread_time.hpp>
#include <boost/tokenizer.hpp>
#include <chrono>
#include <ctime>
+#include <mutex>
#include <regex>
#include <string>
#include <thread>
@@ -49,7 +50,7 @@ class gps_ctrl_impl : public gps_ctrl
{
private:
std::map<std::string, std::tuple<std::string, boost::system_time, bool>> sentences;
- boost::mutex cache_mutex;
+ std::mutex cache_mutex;
boost::system_time _last_cache_update;
std::string get_sentence(const std::string which,
@@ -63,7 +64,7 @@ private:
boost::posix_time::time_duration age;
if (wait_for_next) {
- boost::lock_guard<boost::mutex> lock(cache_mutex);
+ std::lock_guard<std::mutex> lock(cache_mutex);
update_cache();
// mark sentence as touched
if (sentences.find(which) != sentences.end())
@@ -71,7 +72,7 @@ private:
}
while (1) {
try {
- boost::lock_guard<boost::mutex> lock(cache_mutex);
+ std::lock_guard<std::mutex> lock(cache_mutex);
// update cache if older than a millisecond
if (now - _last_cache_update > milliseconds(1)) {
diff --git a/host/lib/usrp/usrp1/soft_time_ctrl.cpp b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
index 1c3015480..c23f572d0 100644
--- a/host/lib/usrp/usrp1/soft_time_ctrl.cpp
+++ b/host/lib/usrp/usrp1/soft_time_ctrl.cpp
@@ -8,8 +8,8 @@
#include "soft_time_ctrl.hpp"
#include <uhd/utils/tasks.hpp>
#include <uhdlib/utils/system_time.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread/condition_variable.hpp>
+#include <boost/thread/condition.hpp>
+#include <chrono>
#include <functional>
#include <iostream>
#include <memory>
@@ -52,13 +52,13 @@ public:
******************************************************************/
void set_time(const time_spec_t& time) override
{
- boost::mutex::scoped_lock lock(_update_mutex);
+ std::lock_guard<std::mutex> lock(_update_mutex);
_time_offset = uhd::get_system_time() - time;
}
time_spec_t get_time(void) override
{
- boost::mutex::scoped_lock lock(_update_mutex);
+ std::lock_guard<std::mutex> lock(_update_mutex);
return time_now();
}
@@ -69,11 +69,11 @@ public:
}
UHD_INLINE void sleep_until_time(
- boost::mutex::scoped_lock& lock, const time_spec_t& time)
+ std::unique_lock<std::mutex>& lock, const time_spec_t& time)
{
- boost::condition_variable cond;
+ boost::condition cond;
// use a condition variable to unlock, sleep, lock
- double seconds_to_sleep = (time - time_now()).get_real_secs();
+ const double seconds_to_sleep = (time - time_now()).get_real_secs();
cond.timed_wait(lock, pt::microseconds(long(seconds_to_sleep * 1e6)));
}
@@ -82,7 +82,7 @@ public:
******************************************************************/
size_t recv_post(rx_metadata_t& md, const size_t nsamps) override
{
- boost::mutex::scoped_lock lock(_update_mutex);
+ std::lock_guard<std::mutex> lock(_update_mutex);
// Since it timed out on the receive, check for inline messages...
// Must do a post check because recv() will not wake up for a message.
@@ -144,7 +144,7 @@ public:
if (not md.has_time_spec)
return;
- boost::mutex::scoped_lock lock(_update_mutex);
+ std::unique_lock<std::mutex> lock(_update_mutex);
time_spec_t time_at(md.time_spec - TWIDDLE);
@@ -168,7 +168,7 @@ public:
******************************************************************/
void recv_cmd_handle_cmd(const stream_cmd_t& cmd)
{
- boost::mutex::scoped_lock lock(_update_mutex);
+ std::unique_lock<std::mutex> lock(_update_mutex);
// handle the stream at time by sleeping
if (not cmd.stream_now) {
@@ -227,7 +227,7 @@ public:
}
private:
- boost::mutex _update_mutex;
+ std::mutex _update_mutex;
size_t _nsamps_remaining;
stream_cmd_t::stream_mode_t _stream_mode;
time_spec_t _time_offset;
diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp
index 792b4721b..a966f91ea 100644
--- a/host/lib/usrp/usrp2/io_impl.cpp
+++ b/host/lib/usrp/usrp2/io_impl.cpp
@@ -92,7 +92,7 @@ public:
*/
UHD_INLINE bool check_fc_condition(double timeout)
{
- boost::mutex::scoped_lock lock(_fc_mutex);
+ std::unique_lock<std::mutex> lock(_fc_mutex);
if (this->ready())
return true;
boost::this_thread::disable_interruption di; // disable because the wait can throw
@@ -105,7 +105,7 @@ public:
*/
UHD_INLINE void update_fc_condition(seq_type seq)
{
- boost::mutex::scoped_lock lock(_fc_mutex);
+ std::unique_lock<std::mutex> lock(_fc_mutex);
_last_seq_ack = seq;
lock.unlock();
_fc_cond.notify_one();
@@ -117,7 +117,7 @@ private:
return seq_type(_last_seq_out - _last_seq_ack) < _max_seqs_out;
}
- boost::mutex _fc_mutex;
+ std::mutex _fc_mutex;
boost::condition _fc_cond;
seq_type _last_seq_out, _last_seq_ack;
const seq_type _max_seqs_out;
diff --git a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp
index 116051216..a4f46fca6 100644
--- a/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp
+++ b/host/lib/usrp/usrp2/usrp2_fifo_ctrl.cpp
@@ -12,9 +12,7 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/safe_call.hpp>
#include <boost/asio.hpp> //htonl
-#include <boost/format.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
+#include <mutex>
using namespace uhd;
using namespace uhd::transport;
@@ -58,7 +56,7 @@ public:
******************************************************************/
void poke32(const wb_addr_type addr, const uint32_t data) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt((addr - SETTING_REGS_BASE) / 4, data, POKE32_CMD);
@@ -67,7 +65,7 @@ public:
uint32_t peek32(const wb_addr_type addr) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt((addr - READBACK_BASE) / 4, 0, PEEK32_CMD);
@@ -92,7 +90,7 @@ public:
******************************************************************/
void init_spi(void)
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
this->send_pkt(SPI_DIV, SPI_DIVIDER, POKE32_CMD);
this->wait_for_ack(_seq_out - MAX_SEQS_OUT);
@@ -106,7 +104,7 @@ public:
size_t num_bits,
bool readback) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
// load control word
uint32_t ctrl_word = 0;
@@ -145,7 +143,7 @@ public:
******************************************************************/
void set_time(const uhd::time_spec_t& time) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_time = time;
_use_time = _time != uhd::time_spec_t(0.0);
if (_use_time)
@@ -154,13 +152,13 @@ public:
uhd::time_spec_t get_time() override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
return _time;
}
void set_tick_rate(const double rate) override
{
- boost::mutex::scoped_lock lock(_mutex);
+ std::lock_guard<std::mutex> lock(_mutex);
_tick_rate = rate;
}
@@ -234,7 +232,7 @@ private:
}
zero_copy_if::sptr _xport;
- boost::mutex _mutex;
+ std::mutex _mutex;
uint16_t _seq_out;
uint16_t _seq_ack;
uhd::time_spec_t _time;
diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp
index 23104d18f..c79ffccab 100644
--- a/host/lib/usrp/usrp2/usrp2_iface.cpp
+++ b/host/lib/usrp/usrp2/usrp2_iface.cpp
@@ -26,6 +26,7 @@
#include <chrono>
#include <functional>
#include <iostream>
+#include <mutex>
#include <thread>
using namespace uhd;
@@ -268,7 +269,7 @@ public:
uint32_t lo = USRP2_FW_COMPAT_NUM,
uint32_t hi = USRP2_FW_COMPAT_NUM)
{
- boost::mutex::scoped_lock lock(_ctrl_mutex);
+ std::lock_guard<std::mutex> lock(_ctrl_mutex);
for (size_t i = 0; i < CTRL_RECV_RETRIES; i++) {
try {
@@ -472,7 +473,7 @@ private:
udp_simple::sptr _ctrl_transport;
// used in send/recv
- boost::mutex _ctrl_mutex;
+ std::mutex _ctrl_mutex;
uint32_t _ctrl_seq_num;
uint32_t _protocol_compat;
diff --git a/host/lib/usrp/usrp_c.cpp b/host/lib/usrp/usrp_c.cpp
index bda9454b6..7b8f3f8a6 100644
--- a/host/lib/usrp/usrp_c.cpp
+++ b/host/lib/usrp/usrp_c.cpp
@@ -12,8 +12,8 @@
#include <uhd/usrp/usrp.h>
#include <uhd/utils/static.hpp>
#include <string.h>
-#include <boost/thread/mutex.hpp>
#include <map>
+#include <mutex>
/****************************************************************************
* Helpers
@@ -86,17 +86,17 @@ UHD_SINGLETON_FCN(usrp_ptrs, get_usrp_ptrs);
/****************************************************************************
* RX Streamer
***************************************************************************/
-static boost::mutex _rx_streamer_make_mutex;
+static std::mutex _rx_streamer_make_mutex;
uhd_error uhd_rx_streamer_make(uhd_rx_streamer_handle* h)
{
- UHD_SAFE_C(boost::mutex::scoped_lock lock(_rx_streamer_make_mutex);
+ UHD_SAFE_C(std::lock_guard<std::mutex> lock(_rx_streamer_make_mutex);
(*h) = new uhd_rx_streamer;)
}
-static boost::mutex _rx_streamer_free_mutex;
+static std::mutex _rx_streamer_free_mutex;
uhd_error uhd_rx_streamer_free(uhd_rx_streamer_handle* h)
{
- UHD_SAFE_C(boost::mutex::scoped_lock lock(_rx_streamer_free_mutex); delete (*h);
+ UHD_SAFE_C(std::lock_guard<std::mutex> lock(_rx_streamer_free_mutex); delete (*h);
(*h) = NULL;)
}
@@ -142,17 +142,17 @@ uhd_error uhd_rx_streamer_last_error(
/****************************************************************************
* TX Streamer
***************************************************************************/
-static boost::mutex _tx_streamer_make_mutex;
+static std::mutex _tx_streamer_make_mutex;
uhd_error uhd_tx_streamer_make(uhd_tx_streamer_handle* h)
{
- UHD_SAFE_C(boost::mutex::scoped_lock lock(_tx_streamer_make_mutex);
+ UHD_SAFE_C(std::lock_guard<std::mutex> lock(_tx_streamer_make_mutex);
(*h) = new uhd_tx_streamer;)
}
-static boost::mutex _tx_streamer_free_mutex;
+static std::mutex _tx_streamer_free_mutex;
uhd_error uhd_tx_streamer_free(uhd_tx_streamer_handle* h)
{
- UHD_SAFE_C(boost::mutex::scoped_lock lock(_tx_streamer_free_mutex); delete *h;
+ UHD_SAFE_C(std::lock_guard<std::mutex> lock(_tx_streamer_free_mutex); delete *h;
*h = NULL;)
}
@@ -199,11 +199,11 @@ uhd_error uhd_tx_streamer_last_error(
/****************************************************************************
* Generate / Destroy API calls
***************************************************************************/
-static boost::mutex _usrp_find_mutex;
+static std::mutex _usrp_find_mutex;
uhd_error uhd_usrp_find(const char* args, uhd_string_vector_handle* strings_out)
{
UHD_SAFE_C(
- boost::mutex::scoped_lock _lock(_usrp_find_mutex);
+ std::lock_guard<std::mutex> _lock(_usrp_find_mutex);
uhd::device_addrs_t devs =
uhd::device::find(std::string(args), uhd::device::USRP);
@@ -212,10 +212,10 @@ uhd_error uhd_usrp_find(const char* args, uhd_string_vector_handle* strings_out)
: devs) { (*strings_out)->string_vector_cpp.push_back(dev.to_string()); })
}
-static boost::mutex _usrp_make_mutex;
+static std::mutex _usrp_make_mutex;
uhd_error uhd_usrp_make(uhd_usrp_handle* h, const char* args)
{
- UHD_SAFE_C(boost::mutex::scoped_lock lock(_usrp_make_mutex);
+ UHD_SAFE_C(std::lock_guard<std::mutex> lock(_usrp_make_mutex);
size_t usrp_count = usrp_ptr::usrp_counter;
usrp_ptr::usrp_counter++;
@@ -233,11 +233,11 @@ uhd_error uhd_usrp_make(uhd_usrp_handle* h, const char* args)
(*h)->usrp_index = usrp_count;)
}
-static boost::mutex _usrp_free_mutex;
+static std::mutex _usrp_free_mutex;
uhd_error uhd_usrp_free(uhd_usrp_handle* h)
{
UHD_SAFE_C(
- boost::mutex::scoped_lock lock(_usrp_free_mutex);
+ std::lock_guard<std::mutex> lock(_usrp_free_mutex);
if (!get_usrp_ptrs().count((*h)->usrp_index)) { return UHD_ERROR_INVALID_DEVICE; }
@@ -253,12 +253,12 @@ uhd_error uhd_usrp_last_error(uhd_usrp_handle h, char* error_out, size_t strbuff
strncpy(error_out, h->last_error.c_str(), strbuffer_len);)
}
-static boost::mutex _usrp_get_rx_stream_mutex;
+static std::mutex _usrp_get_rx_stream_mutex;
uhd_error uhd_usrp_get_rx_stream(
uhd_usrp_handle h_u, uhd_stream_args_t* stream_args, uhd_rx_streamer_handle h_s)
{
UHD_SAFE_C_SAVE_ERROR(
- h_s, boost::mutex::scoped_lock lock(_usrp_get_rx_stream_mutex);
+ h_s, std::lock_guard<std::mutex> lock(_usrp_get_rx_stream_mutex);
if (!get_usrp_ptrs().count(h_u->usrp_index)) {
h_s->last_error = "Streamer's device is invalid or expired.";
@@ -270,12 +270,12 @@ uhd_error uhd_usrp_get_rx_stream(
h_s->usrp_index = h_u->usrp_index;)
}
-static boost::mutex _usrp_get_tx_stream_mutex;
+static std::mutex _usrp_get_tx_stream_mutex;
uhd_error uhd_usrp_get_tx_stream(
uhd_usrp_handle h_u, uhd_stream_args_t* stream_args, uhd_tx_streamer_handle h_s)
{
UHD_SAFE_C_SAVE_ERROR(
- h_s, boost::mutex::scoped_lock lock(_usrp_get_tx_stream_mutex);
+ h_s, std::lock_guard<std::mutex> lock(_usrp_get_tx_stream_mutex);
if (!get_usrp_ptrs().count(h_u->usrp_index)) {
h_s->last_error = "Streamer's device is invalid or expired.";
diff --git a/host/lib/usrp/x300/x300_fw_ctrl.cpp b/host/lib/usrp/x300/x300_fw_ctrl.cpp
index 9cbad7576..110025228 100644
--- a/host/lib/usrp/x300/x300_fw_ctrl.cpp
+++ b/host/lib/usrp/x300/x300_fw_ctrl.cpp
@@ -16,8 +16,8 @@
#include <uhd/utils/log.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/format.hpp>
-#include <boost/thread/mutex.hpp>
#include <chrono>
+#include <mutex>
#include <thread>
using namespace uhd;
@@ -35,14 +35,14 @@ public:
void flush(void)
{
- boost::mutex::scoped_lock lock(reg_access);
+ std::lock_guard<std::mutex> lock(reg_access);
__flush();
}
void poke32(const wb_addr_type addr, const uint32_t data) override
{
for (size_t i = 1; i <= num_retries; i++) {
- boost::mutex::scoped_lock lock(reg_access);
+ std::lock_guard<std::mutex> lock(reg_access);
try {
return this->__poke32(addr, data);
} catch (const uhd::io_error& ex) {
@@ -60,7 +60,7 @@ public:
uint32_t peek32(const wb_addr_type addr) override
{
for (size_t i = 1; i <= num_retries; i++) {
- boost::mutex::scoped_lock lock(reg_access);
+ std::lock_guard<std::mutex> lock(reg_access);
try {
uint32_t data = this->__peek32(addr);
return data;
@@ -85,7 +85,7 @@ protected:
virtual void __flush() = 0;
virtual std::string __loc_info() = 0;
- boost::mutex reg_access;
+ std::mutex reg_access;
};
diff --git a/host/lib/usrp/x300/x300_fw_uart.cpp b/host/lib/usrp/x300/x300_fw_uart.cpp
index 1bfc2a2e4..804a1a357 100644
--- a/host/lib/usrp/x300/x300_fw_uart.cpp
+++ b/host/lib/usrp/x300/x300_fw_uart.cpp
@@ -11,8 +11,8 @@
#include <uhd/types/serial.hpp>
#include <uhd/types/wb_iface.hpp>
#include <uhd/utils/log.hpp>
-#include <boost/format.hpp>
#include <chrono>
+#include <mutex>
using namespace uhd;
@@ -52,7 +52,7 @@ struct x300_uart_iface : uart_iface
void write_uart(const std::string& buff) override
{
- boost::mutex::scoped_lock lock(_write_mutex);
+ std::lock_guard<std::mutex> lock(_write_mutex);
for (const char ch : buff) {
this->putchar(ch);
}
@@ -120,7 +120,7 @@ struct x300_uart_iface : uart_iface
std::string read_uart(double timeout) override
{
- boost::mutex::scoped_lock lock(_read_mutex);
+ std::lock_guard<std::mutex> lock(_read_mutex);
const auto exit_time = std::chrono::steady_clock::now()
+ std::chrono::microseconds(int64_t(timeout * 1e6));
@@ -156,8 +156,8 @@ struct x300_uart_iface : uart_iface
uint32_t _last_device_rxoffset;
std::vector<uint32_t> _rxcache;
std::string _rxbuff;
- boost::mutex _read_mutex;
- boost::mutex _write_mutex;
+ std::mutex _read_mutex;
+ std::mutex _write_mutex;
};
uart_iface::sptr x300_make_uart_iface(wb_iface::sptr iface)