Notification string to a queue of strings ()

Fixes 

* made inputdata to queue<string>

* changed back to front

* fixed move semantics issue while popping queue

* Removed ide file

* commented test lines

* review changes

* review changes

* Update CHANGELOG.md

* Cleanup

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
This commit is contained in:
Madhav Prabhu C M 2021-10-03 14:54:24 +05:30 committed by GitHub
parent 1a59599388
commit e5ab7e1c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 13 deletions
src/components

View file

@ -128,13 +128,9 @@ bool controller::run(bool writeback, string snapshot_dst, bool confwatch) {
*/
void controller::trigger_action(string&& input_data) {
std::unique_lock<std::mutex> guard(m_notification_mutex);
if (m_notifications.inputdata.empty()) {
m_notifications.inputdata = std::move(input_data);
trigger_notification();
} else {
m_log.trace("controller: Swallowing input event (pending data)");
}
m_log.trace("controller: Queueing input event '%s'", input_data);
m_notifications.inputdata.push(std::move(input_data));
trigger_notification();
}
void controller::trigger_quit(bool reload) {
@ -215,8 +211,11 @@ void controller::notifier_handler() {
return;
}
if (!data.inputdata.empty()) {
process_inputdata(std::move(data.inputdata));
while (!data.inputdata.empty()) {
auto inputdata = data.inputdata.front();
data.inputdata.pop();
m_log.trace("controller: Dequeueing inputdata: '%s'", inputdata);
process_inputdata(std::move(inputdata));
}
if (data.update) {
@ -461,7 +460,6 @@ void controller::process_inputdata(string&& cmd) {
m_log.err("controller: Error while forwarding input to shell -> %s", err.what());
}
}
/**
* Process eventqueue update event
*/