mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-15 09:31:45 +00:00
fix(plugins): Avoid double device control releases
This was not really broken, but it generated a debug log message containing the keyword 'error' consistently, which is convoluting any debugging session. This commit also adds some trace log message on plugin device control API calls.
This commit is contained in:
committed by
Dennis Klein
parent
b374c235f0
commit
e2452fa7e4
@@ -6,6 +6,7 @@
|
||||
* copied verbatim in the file "LICENSE" *
|
||||
********************************************************************************/
|
||||
|
||||
#include <fairlogger/Logger.h>
|
||||
#include <fairmq/PluginServices.h>
|
||||
#include <fairmq/tools/Strings.h>
|
||||
|
||||
@@ -34,8 +35,10 @@ auto PluginServices::TakeDeviceControl(const string& controller) -> void
|
||||
|
||||
if (!fDeviceController) {
|
||||
fDeviceController = controller;
|
||||
LOG(trace) << "Plugin '" << controller << "' took over control.";
|
||||
} else if (fDeviceController == controller) {
|
||||
// nothing to do
|
||||
LOG(trace) << "Plugin '" << controller << "' is already in control.";
|
||||
} else {
|
||||
throw DeviceControlError{tools::ToString(
|
||||
"Plugin '", controller, "' is not allowed to take over control. ",
|
||||
@@ -49,6 +52,7 @@ auto PluginServices::StealDeviceControl(const string& controller) -> void
|
||||
lock_guard<mutex> lock{fDeviceControllerMutex};
|
||||
|
||||
fDeviceController = controller;
|
||||
LOG(trace) << "Plugin '" << controller << "' steals control!";
|
||||
}
|
||||
|
||||
auto PluginServices::ReleaseDeviceControl(const string& controller) -> void
|
||||
@@ -58,6 +62,7 @@ auto PluginServices::ReleaseDeviceControl(const string& controller) -> void
|
||||
|
||||
if (fDeviceController == controller) {
|
||||
fDeviceController = boost::none;
|
||||
LOG(trace) << "Plugin '" << controller << "' releases control.";
|
||||
} else {
|
||||
LOG(debug) << "Plugin '" << controller << "' cannot release control "
|
||||
<< "because it has no control.";
|
||||
|
Reference in New Issue
Block a user