thread: add pthread-based threading module#72
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
There was a problem hiding this comment.
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
threadcrate withspawn+JoinHandle, plusThreadParameters/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.
600faab to
cadcd38
Compare
There was a problem hiding this comment.
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
threadcrate withspawn,JoinHandle, andThreadParameters/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.
cadcd38 to
915a0b6
Compare
915a0b6 to
237f7fb
Compare
There was a problem hiding this comment.
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
threadcrate withspawn+JoinHandle, and parameter types for scheduler policy/priority, affinity, and stack size. - Introduce
palcrate 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.
1057ce0 to
d405563
Compare
There was a problem hiding this comment.
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
palcrate providing errno access, CPU affinity abstraction, and pthread/libc re-exports. - Introduce
threadcrate withspawn(f, ThreadParameters) -> JoinHandleand 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.
d405563 to
32efb21
Compare
32efb21 to
9a2937f
Compare
Parametrizable threading module.
1e670dd to
e73e6a8
Compare
Parametrizable threading module.
Notes for Reviewer
Pre-Review Checklist for the PR Author
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #78