From 7fdeb444edcc5722aada16ca0c86c4ac6a44ad6f Mon Sep 17 00:00:00 2001 From: Virendra Kakade Date: Wed, 27 Feb 2019 20:11:07 -0600 Subject: mpmd: Fix spurious reclaim call after unclaim The reclaim task loop is asnychronous to the main thread which can result in spurious reclaim call to the device after unclaim has been called. This is especially risky if the device has already entered a non-serviceable state after unclaim e.g. idle state. Signed-off-by: Virendra Kakade --- host/lib/usrp/mpmd/mpmd_mboard_impl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp index da4f99794..e2d347778 100644 --- a/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp +++ b/host/lib/usrp/mpmd/mpmd_mboard_impl.cpp @@ -302,9 +302,12 @@ mpmd_mboard_impl::mpmd_mboard_impl( mpmd_mboard_impl::~mpmd_mboard_impl() { - UHD_SAFE_CALL(dump_logs(); if (not rpc->request_with_token("unclaim")) { - UHD_LOG_WARNING("MPMD", "Failure to ack unclaim!"); - }); + // Destroy the claimer task to avoid spurious asynchronous reclaim call after the + // unclaim. + UHD_SAFE_CALL(dump_logs(); _claimer_task.reset(); + if (not rpc->request_with_token("unclaim")) { + UHD_LOG_WARNING("MPMD", "Failure to ack unclaim!"); + }); } /***************************************************************************** -- cgit v1.2.3