Skip to content

Commit 1a25c38

Browse files
Stop inline emits for IO control messages.
IO bind/unbind/finished events now use default Local emit so Pool<IOPool> handlers are queued to the IO pool instead of running on the emitter thread. Inline::NEVER on control handlers and Inline::ALWAYS bump reactions are kept. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent f62b7dc commit 1a25c38

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

src/dsl/word/IO.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "../store/ThreadStore.hpp"
3131
#include "../trait/is_transient.hpp"
3232
#include "Single.hpp"
33-
#include "emit/Inline.hpp"
3433

3534
namespace NUClear {
3635
namespace dsl {
@@ -132,13 +131,13 @@ namespace dsl {
132131
static void bind(const std::shared_ptr<threading::Reaction>& reaction, fd_t fd, event_t watch_set) {
133132

134133
reaction->unbinders.emplace_back([](const threading::Reaction& r) {
135-
r.reactor.emit<emit::Inline>(std::make_unique<operation::Unbind<IO>>(r.id));
134+
r.reactor.emit(std::make_unique<operation::Unbind<IO>>(r.id));
136135
});
137136

138137
auto io_config = std::make_unique<IOConfiguration>(fd, watch_set, reaction);
139138

140139
// Send our configuration out
141-
reaction->reactor.emit<emit::Inline>(io_config);
140+
reaction->reactor.emit(io_config);
142141
}
143142

144143
template <typename DSL>
@@ -155,7 +154,7 @@ namespace dsl {
155154

156155
template <typename DSL>
157156
static void post_run(threading::ReactionTask& task) {
158-
task.parent->reactor.emit<emit::Inline>(std::make_unique<IOFinished>(task.parent->id));
157+
task.parent->reactor.emit(std::make_unique<IOFinished>(task.parent->id));
159158
}
160159
};
161160

src/extension/IOController_Posix.ipp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ namespace extension {
169169
// Start by rebuilding the list
170170
rebuild_list();
171171

172-
// Control handlers run on the IO pool at HIGH priority with Inline::NEVER so emit<Inline>
173-
// cannot execute them on the default pool while ::poll() holds watches[]. Inline wake
172+
// Control handlers run on the IO pool at HIGH priority with Inline::NEVER so they are
173+
// always queued to the IO pool rather than running on the emitting thread. Inline wake
174174
// reactions registered after them only write to the notify pipe so ::poll() unblocks.
175175
on<Trigger<dsl::word::IOConfiguration>, Pool<IOPool>, Priority::HIGH, Inline::NEVER>().then(
176176
"Configure IO Reaction",

0 commit comments

Comments
 (0)