Skip to content

thread: add pthread-based threading module#72

Merged
pawelrutkaq merged 1 commit intoeclipse-score:mainfrom
qorix-group:arkjedrz_custom-thread
Mar 24, 2026
Merged

thread: add pthread-based threading module#72
pawelrutkaq merged 1 commit intoeclipse-score:mainfrom
qorix-group:arkjedrz_custom-thread

Conversation

@arkjedrz
Copy link
Copy Markdown
Contributor

@arkjedrz arkjedrz commented Mar 13, 2026

Parametrizable threading module.

Notes for Reviewer

Pre-Review Checklist for the PR Author

  • PR title is short, expressive and meaningful
  • Commits are properly organized
  • Relevant issues are linked in the References section
  • Tests are conducted
  • Unit tests are added

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  • All open points are addressed and tracked via issues

References

Closes #78

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 13, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.4.2) and connecting to it...
INFO: Invocation ID: 086269c5-ea30-495e-a1ea-fe9b3998bf73
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'rules_python', the root module requires module version rules_python@1.4.1, but got rules_python@1.8.3 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'bazel_skylib', the root module requires module version bazel_skylib@1.7.1, but got bazel_skylib@1.8.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_rust', the root module requires module version rules_rust@0.61.0, but got rules_rust@0.67.0 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'rules_cc', the root module requires module version rules_cc@0.1.1, but got rules_cc@0.2.14 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
WARNING: For repository 'buildifier_prebuilt', the root module requires module version buildifier_prebuilt@7.3.1, but got buildifier_prebuilt@8.2.0.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (25 packages loaded, 9 targets configured)

Analyzing: target //:license-check (85 packages loaded, 9 targets configured)

Analyzing: target //:license-check (143 packages loaded, 1088 targets configured)

Analyzing: target //:license-check (143 packages loaded, 1088 targets configured)

Analyzing: target //:license-check (152 packages loaded, 1717 targets configured)

Analyzing: target //:license-check (154 packages loaded, 3170 targets configured)

Analyzing: target //:license-check (165 packages loaded, 3234 targets configured)

Analyzing: target //:license-check (165 packages loaded, 3236 targets configured)

Analyzing: target //:license-check (165 packages loaded, 3236 targets configured)

Analyzing: target //:license-check (168 packages loaded, 5116 targets configured)

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

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

Analyzing: target //:license-check (197 packages loaded, 5552 targets configured)
[11 / 17] Creating runfiles tree bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/score_tooling+/dash/tool/formatters/dash_format_converter.runfiles [for tool]; 0s local ... (3 actions, 2 running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 5 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
Analyzing: target //:license-check (197 packages loaded, 5552 targets configured)
[15 / 17] [Prepa] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar
Analyzing: target //:license-check (197 packages loaded, 5552 targets configured)
[16 / 17] [Prepa] Building license.check.license_check.jar ()
Analyzing: target //:license-check (197 packages loaded, 5552 targets configured)
[17 / 17] no actions running
Analyzing: target //:license-check (198 packages loaded, 7717 targets configured)
[17 / 17] no actions running
INFO: Analyzed target //:license-check (198 packages loaded, 9886 targets configured).
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: 28.945s, Critical Path: 3.52s
INFO: 17 processes: 12 internal, 4 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 17 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>]

@github-actions
Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Copy link
Copy Markdown

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 thread Rust crate that provides a pthread-based, parameterizable thread-spawning API (scheduler policy/priority, CPU affinity, stack size) and integrates it into the workspace build (Cargo + Bazel).

Changes:

  • Introduce thread crate with spawn + JoinHandle, plus ThreadParameters/SchedulerParameters.
  • Implement pthread_attr_* configuration for scheduling, affinity, and stack size.
  • Register the crate in the workspace (Cargo.toml, Cargo.lock) and Bazel (src/thread/BUILD).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/thread/thread.rs Core pthread-based implementation and unit tests.
src/thread/parameters.rs Public parameter types for scheduler/affinity/stack size, plus tests.
src/thread/lib.rs Crate module wiring and public re-exports.
src/thread/Cargo.toml New crate manifest using workspace libc.
src/thread/BUILD Bazel targets for the new Rust library and its tests.
Cargo.toml Add src/thread to workspace members/default-members and deps.
Cargo.lock Lockfile updates for new thread crate and libc.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown

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 thread workspace crate providing a pthread-backed API to spawn threads with configurable scheduler policy/priority, CPU affinity, and stack size.

Changes:

  • Introduces a new thread crate with spawn, JoinHandle, and ThreadParameters/SchedulerParameters.
  • Adds a minimal POSIX/pthread FFI layer and unit tests for attributes/spawn behavior.
  • Registers the new crate in the workspace (Cargo + Bazel).

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/thread/thread.rs Implements pthread-backed spawning/joining + attribute handling and tests.
src/thread/posix.rs Adds POSIX/pthread FFI declarations and CPU set helpers.
src/thread/parameters.rs Adds public parameter types for scheduler/affinity/stack size + tests.
src/thread/lib.rs Crate module wiring and public re-exports.
src/thread/Cargo.toml New crate manifest and dependencies.
src/thread/BUILD Bazel targets for library and unit tests.
Cargo.toml Adds src/thread to workspace members and dependencies.
Cargo.lock Records resolved workspace dependency updates (e.g., libc).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from cadcd38 to 915a0b6 Compare March 16, 2026 11:01
@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from 915a0b6 to 237f7fb Compare March 17, 2026 12:46
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 17, 2026 12:46 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 17, 2026 12:46 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 19, 2026 12:53 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 19, 2026 12:53 — with GitHub Actions Inactive
@arkjedrz arkjedrz requested review from Copilot and pawelrutkaq March 19, 2026 13:32
Copy link
Copy Markdown

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 pthread-based threading crate (src/thread) with configurable scheduling/affinity/stack parameters, backed by a minimal POSIX adaptation layer crate (src/pal). This expands the workspace with reusable primitives for spawning/joining threads with platform-specific affinity support (Linux/QNX).

Changes:

  • Introduce thread crate with spawn + JoinHandle, and parameter types for scheduler policy/priority, affinity, and stack size.
  • Introduce pal crate exposing minimal pthread/sched APIs plus cross-OS CPU affinity handling.
  • Register both crates in the workspace (Cargo + Bazel).

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/thread/thread.rs Implements pthread-backed spawning/joining, attribute configuration, and unit tests.
src/thread/parameters.rs Defines ThreadParameters, SchedulerPolicy, and SchedulerParameters with validation + tests.
src/thread/lib.rs Crate entrypoint; re-exports public API.
src/thread/Cargo.toml Declares the new thread crate and dependencies.
src/thread/BUILD Bazel targets for thread library and tests.
src/pal/lib.rs Minimal POSIX adaptation layer exports (pthread/sched + affinity module).
src/pal/affinity.rs Cross-OS CPU affinity mask abstraction and set/get implementations + tests.
src/pal/Cargo.toml Declares the new pal crate and dependencies.
src/pal/BUILD Bazel targets for pal library and tests.
Cargo.toml Adds pal/thread to workspace members and adds libc workspace dependency.
Cargo.lock Locks new dependencies (libc) and new workspace crates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from 1057ce0 to d405563 Compare March 20, 2026 08:01
@arkjedrz arkjedrz requested a deployment to workflow-approval March 20, 2026 08:01 — with GitHub Actions Waiting
@arkjedrz arkjedrz requested a deployment to workflow-approval March 20, 2026 08:01 — with GitHub Actions Waiting
@arkjedrz arkjedrz requested a review from Copilot March 20, 2026 08:01
@arkjedrz arkjedrz marked this pull request as ready for review March 20, 2026 08:01
Copy link
Copy Markdown

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 pthread-based threading crate (src/thread) backed by a minimal POSIX adaptation layer (src/pal) to support parametrized thread creation (scheduler policy/priority, affinity, stack size) across Linux and QNX targets.

Changes:

  • Introduce pal crate providing errno access, CPU affinity abstraction, and pthread/libc re-exports.
  • Introduce thread crate with spawn(f, ThreadParameters) -> JoinHandle and scheduling/affinity/stack configuration support.
  • Wire both crates into the Cargo workspace and Bazel build/test targets.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/thread/thread.rs Implements pthread-backed spawn/join handling with parameter application and unit tests.
src/thread/parameters.rs Defines ThreadParameters, SchedulerPolicy, and SchedulerParameters with validation and tests.
src/thread/lib.rs Exposes the public API surface for the new thread crate.
src/thread/Cargo.toml Adds the new thread crate configuration and dependencies.
src/thread/BUILD Bazel targets for the thread library and its tests.
src/pal/lib.rs Defines the POSIX adaptation layer public surface (pthread/libc exports, affinity/errno modules).
src/pal/errno.rs Adds cross-platform errno() accessor implementation.
src/pal/affinity.rs Implements Linux/QNX thread affinity set/get with a common CpuSet representation and tests.
src/pal/Cargo.toml Adds the new pal crate configuration and dependencies.
src/pal/BUILD Bazel targets for the pal library and its tests.
Cargo.toml Registers pal and thread as workspace members and adds workspace dependencies.
Cargo.lock Captures new dependency graph entries for libc, pal, and thread.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from d405563 to 32efb21 Compare March 20, 2026 08:45
@arkjedrz arkjedrz requested a deployment to workflow-approval March 20, 2026 08:45 — with GitHub Actions Waiting
@arkjedrz arkjedrz requested a deployment to workflow-approval March 20, 2026 08:45 — with GitHub Actions Waiting
@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from 32efb21 to 9a2937f Compare March 20, 2026 08:46
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 20, 2026 08:46 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 20, 2026 08:46 — with GitHub Actions Inactive
Parametrizable threading module.
@arkjedrz arkjedrz force-pushed the arkjedrz_custom-thread branch from 1e670dd to e73e6a8 Compare March 24, 2026 08:44
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 24, 2026 08:44 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 24, 2026 08:44 — with GitHub Actions Inactive
@github-project-automation github-project-automation bot moved this from In Progress to On Hold in BAS - Baselibs FT Mar 24, 2026
@pawelrutkaq pawelrutkaq merged commit b882fc9 into eclipse-score:main Mar 24, 2026
13 checks passed
@github-project-automation github-project-automation bot moved this from On Hold to Done in BAS - Baselibs FT Mar 24, 2026
@arkjedrz arkjedrz deleted the arkjedrz_custom-thread branch March 24, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Improvement: parametrizable pthread-based threading module

3 participants