|
@@ -9,13 +9,11 @@ namespace message {
|
|
|
struct Ping : rl::Message {
|
|
|
using Message::Message;
|
|
|
static constexpr auto type_id = __LINE__;
|
|
|
- rl::MessageTypeId get_type_id() const override { return type_id; }
|
|
|
};
|
|
|
|
|
|
struct Pong : rl::Message {
|
|
|
using Message::Message;
|
|
|
static constexpr auto type_id = __LINE__;
|
|
|
- rl::MessageTypeId get_type_id() const override { return type_id; }
|
|
|
};
|
|
|
} // namespace message
|
|
|
|
|
@@ -34,11 +32,11 @@ struct Pinger : rl::Actor<2> {
|
|
|
|
|
|
void ping() {
|
|
|
Board::toggle_led();
|
|
|
- send<message::Ping>(0, ponger_id);
|
|
|
+ send<rl::ctx::thread, message::Ping>(0, ponger_id);
|
|
|
}
|
|
|
|
|
|
void on_pong(message::Pong &) {
|
|
|
- add_event(
|
|
|
+ add_event<rl::ctx::thread>(
|
|
|
1, [](void *data) { static_cast<Pinger *>(data)->ping(); }, this);
|
|
|
}
|
|
|
|
|
@@ -52,7 +50,9 @@ struct Ponger : rl::Actor<2> {
|
|
|
subscribe(&Ponger::on_ping);
|
|
|
Parent::initialize();
|
|
|
}
|
|
|
- void on_ping(message::Ping &) { send<message::Pong>(0, pinger_id); }
|
|
|
+ void on_ping(message::Ping &) {
|
|
|
+ send<rl::ctx::thread, message::Pong>(0, pinger_id);
|
|
|
+ }
|
|
|
rl::ActorId pinger_id;
|
|
|
};
|
|
|
|