Skip to content

Improve code structure#3

Merged
thiagoralves merged 13 commits into
developmentfrom
improve-code-structure
Sep 10, 2025
Merged

Improve code structure#3
thiagoralves merged 13 commits into
developmentfrom
improve-code-structure

Conversation

@thiagoralves
Copy link
Copy Markdown
Contributor

This PR fixes many issues in the runtime source code such as:

  • code identation
  • code structure according to BARR-C:2018
  • code organization
  • scan and cycle time calculations
  • thread management

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Sep 9, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Note

🎁 Summarized by CodeRabbit Free

Your organization has reached its limit of developer seats under the Pro Plan. For new users, CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please add seats to your subscription by visiting https://app.coderabbit.ai/login.If you believe this is a mistake and have available seats, please assign one to the pull request author through the subscription management page using the link above.

Comment @coderabbitai help to get the list of available commands and usage tips.

@thiagoralves thiagoralves merged commit 5c394ef into development Sep 10, 2025
1 check passed
@thiagoralves thiagoralves deleted the improve-code-structure branch September 10, 2025 21:55
thiagoralves added a commit that referenced this pull request Mar 5, 2026
- Fix #2: Guard buffer mutex release after crash with a volatile flag
  (holding_buffer_mutex) to avoid undefined behavior when unlocking a
  mutex not owned by the calling thread

- Fix #3: Reset plc_crash_signal to 0 at the start of plc_cycle_thread
  so stale values don't persist after successful recovery

- Fix #4: Add plc_force_error_state() function for the watchdog to
  transition to ERROR state through the mutex instead of writing
  plc_state directly. Remove extern PLCState from watchdog.c

- Fix #5: Skip watchdog heartbeat check when already in ERROR state
  to prevent repeated error log spam every 2 seconds. Move heartbeat
  reset to the non-RUNNING branch so it happens once on ERROR entry

- Fix #6: Add trailing newline to plc_state_manager.h

- Fix #8: Add threading.Lock to protect _crash_times and _safe_mode
  in RuntimeManager against concurrent access from the monitor and
  compilation threads

- Fix #9: Rename _should_enter_safe_mode to
  _record_crash_and_check_safe_mode to make the side effect explicit

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant