Skip to content

Add sequential execution support for serial interface functions#3

Merged
Katze719 merged 18 commits intomainfrom
2-add-support-for-sequential-execution
Jul 23, 2025
Merged

Add sequential execution support for serial interface functions#3
Katze719 merged 18 commits intomainfrom
2-add-support-for-sequential-execution

Conversation

@Katze719
Copy link
Member

  • Introduced a new dispatch mechanism for executing serial interface functions sequentially across threads, ensuring that calls are processed in the order they are made.
  • Added corresponding sequential variants for multiple serial functions, including serialAbortRead, serialRead, serialWrite, and others, to enhance thread safety and execution consistency.
  • Updated the serial.h header to include the new sequential interface headers.

This update improves the robustness of the serial API by providing a clear and reliable way to handle function calls in a sequential manner.

- Introduced a new dispatch mechanism for executing serial interface functions sequentially across threads, ensuring that calls are processed in the order they are made.
- Added corresponding sequential variants for multiple serial functions, including `serialAbortRead`, `serialRead`, `serialWrite`, and others, to enhance thread safety and execution consistency.
- Updated the `serial.h` header to include the new sequential interface headers.

This update improves the robustness of the serial API by providing a clear and reliable way to handle function calls in a sequential manner.
@Katze719 Katze719 requested review from Mqxx and Copilot July 11, 2025 17:22
@Katze719 Katze719 linked an issue Jul 11, 2025 that may be closed by this pull request
@Katze719 Katze719 self-assigned this Jul 11, 2025

This comment was marked as outdated.

Katze719 added 2 commits July 11, 2025 19:28
- Updated the note in the `getVersionSequential` function documentation to specify that it guarantees execution in the exact order the calls were made across threads. This change enhances the clarity of the function's behavior in a multi-threaded context.
- Introduced a new Doxyfile for generating documentation for the cpp-core project, specifying project details and output settings.
- Removed the outdated GitHub Actions workflow for building WASM binaries.
- Added a new GitHub Actions workflow for generating and deploying Doxygen documentation to GitHub Pages, including steps for installation and documentation generation.

These changes enhance project documentation and streamline the deployment process for generated docs.
@Katze719 Katze719 force-pushed the 2-add-support-for-sequential-execution branch 2 times, most recently from d069d60 to 901b2f1 Compare July 11, 2025 17:54
@Katze719 Katze719 force-pushed the 2-add-support-for-sequential-execution branch from 901b2f1 to a4ec5c7 Compare July 11, 2025 18:00
Copy link
Member

@Mqxx Mqxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check if some sequential functions make sense...

Katze719 added 3 commits July 12, 2025 01:27
- Renamed `mtx` to `mutex` and `cv` to `condition_variable` in the `DispatchState` struct for improved clarity and consistency.
- Updated corresponding references in the worker function and call method to reflect the new naming conventions.

These changes enhance code readability and maintainability in the sequential dispatch implementation.
- Introduced a new `setQueueMode` function to allow selection between global and per-handle queue modes for sequential execution.
- Updated existing serial interface functions to utilize the new per-handle mode, ensuring that calls can be executed concurrently across different handles while maintaining order within the same handle.
- Added a new header file for the `setQueueMode` function and updated the main sequential interface header to include it.

These changes enhance the flexibility and performance of the serial API by enabling concurrent execution across multiple serial handles.
- Updated comments and documentation in `sequential_dispatch.h` to clarify the behavior and usage of the sequential dispatching mechanism.
- Improved descriptions for functions such as `queueMode`, `setQueueMode`, and `call`, emphasizing thread safety and the distinction between global and per-handle queue modes.
- Added detailed explanations of the steps involved in executing callables and managing worker threads, enhancing overall clarity for future developers.

These changes improve the comprehensibility of the sequential dispatch API, aiding developers in understanding its functionality and usage.
@Katze719 Katze719 requested review from Mqxx and Copilot July 12, 2025 19:39

This comment was marked as outdated.

- Renamed the static variables in `handleStates` and `handleStatesMutex` from `states` and `mutex` to `instance` for improved clarity and consistency.
- This change enhances code readability and aligns with the naming conventions established in previous commits.
Katze719 and others added 4 commits July 14, 2025 07:37
Co-authored-by: Mqx <62719703+Mqxx@users.noreply.github.com>
- Deleted several sequential interface headers, including `get_version_sequential.h`, `serial_get_ports_info_sequential.h`, `serial_open_sequential.h`, and others, to streamline the codebase and eliminate unused functionality.
- Removed associated inline functions that provided sequential variants for various serial operations, enhancing code clarity and maintainability.
- This cleanup aligns with recent changes to the sequential dispatch mechanism, focusing on a more efficient and cohesive API design.
- Introduced a new header file `squential.h` that aggregates all sequential interface headers for improved organization and accessibility.
- This change streamlines the inclusion of sequential functionalities, enhancing code maintainability and clarity for developers working with the serial interface.
- Added return type descriptions for the `handleStates` and `handleStatesMutex` functions to clarify their purpose and usage.
- Improved formatting of parameter descriptions in the `call` and `ensureWorkerRunning` functions for better readability.

These updates aim to improve the comprehensibility of the sequential dispatch API documentation, aiding developers in understanding its functionality.
@Katze719 Katze719 requested review from Mqxx and Copilot July 14, 2025 20:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds a new sequential dispatch mechanism and corresponding sequential variants for serial interface functions to ensure thread-safe, ordered execution, and updates documentation and CI workflows.

  • Introduce sequential_dispatch.h with per-handle queues and worker threads
  • Add sequential interface headers for all serial functions and include the aggregator in serial.h
  • Update Doxygen config and add a docs workflow; remove the previous WASM build workflow

Reviewed Changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.

Show a summary per file
File Description
include/cpp_core/serial.h Included the new sequential aggregator header
include/cpp_core/interface/sequential/squential.h New aggregator header for sequential interfaces (filename typo)
include/cpp_core/interface/sequential/*.h Sequential variants for all serial API functions
include/cpp_core/detail/sequential_dispatch.h Implementation of the sequential dispatch queue and worker
Doxyfile Initial Doxygen config added
.github/workflows/doxygen.yml Added Doxygen documentation build & deploy workflow
.github/workflows/build.yml Removed old WASM build workflow
Comments suppressed due to low confidence (3)

include/cpp_core/interface/sequential/squential.h:1

  • The aggregator header filename squential.h is misspelled and does not match its purpose or the include in serial.h. Consider renaming it to all.h (or sequential.h) for clarity and consistency.
#pragma once

include/cpp_core/serial.h:8

  • The included header "interface/sequential/all.h" doesn’t exist; the new aggregator file is named squential.h. Either rename the file to all.h or update this include to match the actual filename.
#include "interface/sequential/all.h"

- Replaced the inclusion of the deprecated `all.h` header with the new `sequential.h` header in `serial.h` to streamline header management.
- Introduced `sequential.h`, which aggregates all sequential interface headers, enhancing code maintainability and accessibility for developers working with the serial interface.
- Introduced a new `serial_sequential.h` header that aggregates all sequential interface headers, improving organization and accessibility.
- Removed the deprecated `sequential.h` header from `serial.h` to streamline header management.
- Updated several sequential interface files to include the new `internal/sequential_dispatch.h` for better encapsulation of dispatch logic.

These changes enhance the maintainability and clarity of the serial interface, aligning with recent refactoring efforts.
@Katze719 Katze719 requested a review from Mqxx July 15, 2025 17:00
Katze719 added 2 commits July 16, 2025 21:18
- Replaced instances of `sequential_dispatch.h` with `call.h` in multiple sequential interface headers to streamline the dispatch logic.
- Updated function calls to utilize the new `cpp_core::internal::sequential::call` method, ensuring consistent handling of sequential execution across the interface.
- Improved formatting in several function implementations for better readability.

These changes enhance the maintainability and clarity of the serial interface, aligning with recent refactoring efforts.
…eaders

- Replaced individual sequential header inclusions in `serial_sequential.h` with a single inclusion of `sequential.h` for improved organization.
- Introduced a new `sequential.h` header that consolidates all sequential interface headers, enhancing maintainability and accessibility.

These changes streamline the header management in the serial interface, aligning with ongoing refactoring efforts.
Co-authored-by: Mqx <62719703+Mqxx@users.noreply.github.com>
@Katze719 Katze719 requested a review from Mqxx July 18, 2025 09:16
… `cpp_core.h`

- Deleted the `serial_sequential.h` header to streamline the codebase and eliminate unused functionality.
- Updated `cpp_core.h` to include the new `sequential.h` header, enhancing organization and maintainability of the serial interface.

These changes align with ongoing refactoring efforts to improve header management and code clarity.
@Katze719 Katze719 merged commit 6331bcc into main Jul 23, 2025
@Katze719 Katze719 deleted the 2-add-support-for-sequential-execution branch November 14, 2025 16:40
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.

add support for sequential execution

3 participants