mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
lib: Fix lost wakeup in msg_task startup
msg_task_impl's constructor waits on _start_cv until _running is set,
checking the predicate under _mutex. task_loop() set _running and
called notify_one() without taking _mutex, so a notification sent
after the constructor had checked the predicate but before it started
to wait was lost, and the constructor then blocked forever.
The condition-variable handshake replaced a boost::barrier, which
cannot lose a wakeup, in 3855516f6f ("lib: Remove boost::thread usage
from USB transports"), so UHD 4.10.0.0 and 4.11.0.0 are affected. On
a B210 the hang leaves b200_impl's constructor blocked in
msg_task::make() right after "Operating over USB 3.". It shows up
most when the device is opened at a real-time priority, as SDR
applications that raise their priority before opening the device do.
Set _running while holding _mutex, then notify.
This commit is contained in:
parent
7a44637627
commit
ec86cd7b2c
@ -124,7 +124,12 @@ public:
|
||||
private:
|
||||
void task_loop(const task_fcn_type& task_fcn)
|
||||
{
|
||||
{
|
||||
// Set the predicate under the mutex: the constructor checks it under
|
||||
// _mutex before waiting, so a notify sent in between would be lost.
|
||||
std::lock_guard<std::mutex> lock(_mutex);
|
||||
_running = true;
|
||||
}
|
||||
_start_cv.notify_one();
|
||||
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user