Notification string to a queue of strings (#2517)
Fixes #2469 * 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:
parent
1a59599388
commit
e5ab7e1c00
4 changed files with 16 additions and 13 deletions
src/components
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue