diff options
author | Patrick Sisterhen <patrick.sisterhen@ni.com> | 2019-12-12 23:34:12 -0600 |
---|---|---|
committer | Brent Stapleton <brent.stapleton@ettus.com> | 2020-01-02 15:18:25 -0800 |
commit | b6f50e7f108614f57c6a934a40929470465564d1 (patch) | |
tree | 0ea530b10570bbfd82513c49c16518f5ce6533cb | |
parent | db4e3833778a32a249affb376756c177397c8b84 (diff) | |
download | uhd-b6f50e7f108614f57c6a934a40929470465564d1.tar.gz uhd-b6f50e7f108614f57c6a934a40929470465564d1.tar.bz2 uhd-b6f50e7f108614f57c6a934a40929470465564d1.zip |
uhd: fix for exception due to use of unconstructed mutex
In chdr_ctrl_endpoint recv_thread, _recv_thread was starting
at construction time and trying to lock mutex, but due to member
declaration in class, mutex was not yet constructed
-rw-r--r-- | host/lib/rfnoc/chdr_ctrl_endpoint.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp index d337dec5e..bba972186 100644 --- a/host/lib/rfnoc/chdr_ctrl_endpoint.cpp +++ b/host/lib/rfnoc/chdr_ctrl_endpoint.cpp @@ -31,7 +31,6 @@ public: sep_id_t my_epid) : _my_epid(my_epid) , _xport(xport) - , _send_seqnum(0) , _send_pkt(pkt_factory.make_ctrl()) , _recv_pkt(pkt_factory.make_ctrl()) , _stop_recv_thread(false) @@ -177,13 +176,15 @@ private: chdr_ctrl_packet::cuptr _recv_pkt; // A collection of ctrlport endpoints (keyed by the port number) std::map<ep_map_key_t, ctrlport_endpoint::sptr> _endpoint_map; - // A thread that will handle all responses and async message requests - std::atomic_bool _stop_recv_thread; - std::thread _recv_thread; // Mutex that protects all state in this class except for _send_pkt std::mutex _mutex; // Mutex that protects _send_pkt and _xport.send std::mutex _send_mutex; + // A thread that will handle all responses and async message requests + // Must be declared after the mutexes, the thread starts at construction and + // depends on the mutexes having been constructed. + std::atomic_bool _stop_recv_thread; + std::thread _recv_thread; }; chdr_ctrl_endpoint::uptr chdr_ctrl_endpoint::make(chdr_ctrl_xport::sptr xport, |