Repository navigation
Power devices: send Heartbeats on Linux and macOS (make the Handshaking thread its reactor's owner) - #34
Open
nyhnpya wants to merge 1 commit into
Open
Power devices: send Heartbeats on Linux and macOS (make the Handshaking thread its reactor's owner)#34nyhnpya wants to merge 1 commit into
nyhnpya wants to merge 1 commit into
Conversation
…rtbeats are sent PowerDevice::run_i() runs the Handshaking reactor, which drives the Heartbeat timer, in a new thread. The reactor is created on the constructing thread, and off Windows it is an ACE_Select_Reactor, whose handle_events() returns -1 (EACCES) when it isn't called from its owner thread. run_reactor_event_loop() then returns at once, so Source, Load and Distribution never send a Heartbeat (MIL-STD-3071 §B.4) on Linux or macOS. Make the new thread the reactor's owner before running its event loop. Fixes OpenDDS#33
sonndinh
reviewed
Nov 20, 2026
sonndinh
left a comment
Member
There was a problem hiding this comment.
Thank you for contributing! The changes look good to me. I'll test it locally and get back to you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #33.
Problem
On Linux and macOS, the TMS power devices (
Source,LoadandDistribution) never send a Heartbeat. MIL-STD-3071 §B.4 requires one every second.PowerDevice::run_i()runs the Handshaking reactor, which drives the Heartbeat timer, in a new thread. That reactor is created on the constructing thread. Off Windows it is anACE_Select_Reactor, whosehandle_events()returns -1 withEACCESwhen it isn't called from its owner thread (ace/Select_Reactor_T.cpp). Sorun_reactor_event_loop()returns at once, and the timer never fires. The Windows default (WFMO) has no owner check, which is probably why CI doesn't catch this.Change
Make the new thread the reactor's owner before running its event loop (
PowerDevice.h, a one-line change plus a comment).Testing
macOS 15 arm64, OpenDDS master
01bb58f, built as in.github/workflows/TMS.yml.Controller,SourceandLoadran on domain 11 withrtps_disc.ini, and Heartbeat DATA submessages were counted over 13 s:cbbccf6)A separate MIL-STD-3071 implementation on the same domain also saw all three devices only with the change.