Skip to content

vehicle_time: Deliver VehicleClock callbacks from a worker thread - #215

Open
florianfueller wants to merge 4 commits into
eclipse-score:mainfrom
florianfueller:feature/59-vehicle-clock-callback-delivery
Open

vehicle_time: Deliver VehicleClock callbacks from a worker thread#215
florianfueller wants to merge 4 commits into
eclipse-score:mainfrom
florianfueller:feature/59-vehicle-clock-callback-delivery

Conversation

@florianfueller

@florianfueller florianfueller commented Sep 8, 2026

Copy link
Copy Markdown

Improvement

Description

Implement callback delivery in VehicleClockBackendImpl; the Set*/Unset* methods were
no-ops so far.

  • A worker thread, started by the first successful Init(), polls the TimeDaemon shared
    memory every 50 ms while at least one callback is registered and dispatches on that thread.
  • TimeSlaveSyncData / PDelayMeasurementData fire on every changed frame.
  • VehicleTimeStatus fires once after registration, then only when the flags change
    (rate deviation excluded).
  • Subscribe / Unsubscribe are safe against in-flight invocations, including calls from
    inside a callback.
  • Unit tests added; docs and comments updated, "not yet delivered" warnings removed.

Related ticket

closes #59 (improvement ticket)

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 27726e0f-cf1f-4a35-a9a8-92314acab12f
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'platforms', the root module requires module version platforms@1.0.0, but got platforms@1.1.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 3 packages loaded
Analyzing: target //:license-check (4 packages loaded, 0 targets configured)
Analyzing: target //:license-check (4 packages loaded, 0 targets configured)

Analyzing: target //:license-check (72 packages loaded, 10 targets configured)

Analyzing: target //:license-check (109 packages loaded, 449 targets configured)

Analyzing: target //:license-check (157 packages loaded, 3160 targets configured)

Analyzing: target //:license-check (164 packages loaded, 6259 targets configured)

Analyzing: target //:license-check (169 packages loaded, 6308 targets configured)

Analyzing: target //:license-check (169 packages loaded, 6308 targets configured)

Analyzing: target //:license-check (169 packages loaded, 6308 targets configured)

Analyzing: target //:license-check (172 packages loaded, 8195 targets configured)

Analyzing: target //:license-check (175 packages loaded, 11421 targets configured)

Analyzing: target //:license-check (176 packages loaded, 11429 targets configured)

Analyzing: target //:license-check (176 packages loaded, 11429 targets configured)

Analyzing: target //:license-check (176 packages loaded, 11429 targets configured)

INFO: Analyzed target //:license-check (177 packages loaded, 11555 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 2 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 33.734s, Critical Path: 2.70s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

Implement callback delivery in VehicleClockBackendImpl; the Set and
Unset methods were no-ops so far.

- A worker thread, started by the first successful Init(), polls the
  TimeDaemon shared memory every 50 ms while at least one callback is
  registered and dispatches on that thread.
- TimeSlaveSyncData and PDelayMeasurementData fire on every changed
  frame.
- VehicleTimeStatus fires once after registration, then only when the
  flags change (rate deviation excluded).
- Subscribe and Unsubscribe are safe against in-flight invocations,
  including calls from inside a callback.
- Add unit tests, update docs and comments, remove the "not yet
  delivered" warnings.

Refs eclipse-score#59

Signed-off-by: Florian Füller <5454068+florianfueller@users.noreply.github.com>
@florianfueller
florianfueller force-pushed the feature/59-vehicle-clock-callback-delivery branch from d447876 to a816147 Compare September 9, 2026 12:37
@florianfueller
florianfueller marked this pull request as ready for review September 9, 2026 12:38
Move change detection into CallbackSlot: the slot remembers the key of
the last delivered value and forgets it on Set/Unset, so every newly
registered callback receives the next frame and afterwards only
changes. This replaces the registration counter and the backend's
per-event bookkeeping.

- Run the callback under a recursive mutex instead of the explicit
  in-flight wait; the mutex now provides the Set/Unset guarantees.
- Adapt unit tests and docs.

Refs eclipse-score#59

Signed-off-by: Florian Füller <5454068+florianfueller@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Improvement: Implement the callbacks envoking

1 participant