-
Notifications
You must be signed in to change notification settings - Fork 5
[2/6] feat: add Pid and process linking primitives #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
unbalancedparentheses
wants to merge
7
commits into
lambdaclass:main
from
unbalancedparentheses:pr/1-pid-primitives
Closed
[2/6] feat: add Pid and process linking primitives #68
unbalancedparentheses
wants to merge
7
commits into
lambdaclass:main
from
unbalancedparentheses:pr/1-pid-primitives
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jan 8, 2026
Consolidate the two separate GenServer implementations (async/tokio and threads) into a single implementation with a Backend enum parameter. Breaking change: start() now requires a Backend argument: - Backend::Async - tokio async tasks (default) - Backend::Blocking - tokio's blocking thread pool - Backend::Thread - dedicated OS thread This provides runtime flexibility without code duplication, allowing users to mix different execution backends in the same application. - Add Backend enum to gen_server.rs - Change start() signature to accept Backend parameter - Update all examples and tests - Remove thread-based example crates
Add 10 new tests covering: - Backend enum traits (Default, Copy, Clone, Debug, PartialEq, Eq) - All three backends handle call/cast correctly - Backend::Thread isolates blocking work from async runtime - Multiple backends can run concurrently with independent state - Backend::default() works in start()
Document each backend option with: - Comparison table showing execution model, best use cases, and limitations - Code examples for each backend - Detailed "When to Use" guide with advantages and avoid-when advice - Per-variant documentation with specific use cases
Property-based tests (proptest): - Counter preserves initial state - N increments result in initial + N - Get is idempotent (multiple calls return same value) - All backends produce working GenServers - Multiple GenServers maintain independent state - Cast followed by Get reflects the cast Fuzzing (cargo-fuzz): - Add fuzz target for GenServer operations - Test random sequences of call/cast operations - Verify state consistency across all backends - Run with: cd concurrency/fuzz && cargo fuzz run fuzz_genserver_operations
… communication - Backend equivalence tests: verify all backends produce identical results - Cross-backend communication: test GenServers on different backends calling each other - Stress tests: concurrent operations, mixed call/cast - Init/teardown: verify lifecycle hooks work on all backends - State consistency: large operations, alternating operations
36fa138 to
3a874d6
Compare
This was referenced Jan 8, 2026
3a874d6 to
25a0607
Compare
This was referenced Jan 8, 2026
- Remove concurrency/src/threads/ directory (replaced by Backend enum) - Move files from concurrency/src/tasks/ to concurrency/src/ - Update all imports from spawned_concurrency::tasks:: to spawned_concurrency:: - Update internal crate imports accordingly - Update examples README to reflect current architecture The Backend enum (Async, Blocking, Thread) now provides all the functionality previously split between tasks and threads modules, offering a cleaner and more unified API.
- Add Pid struct with unique process identifiers (AtomicU64) - Add HasPid trait for types that have a process ID - Add ExitReason enum (Normal, Shutdown, Error, Killed) - Add MonitorRef for tracking monitors - Add SystemMessage enum (Down, Exit, Timeout) These are the foundational types for OTP-style process management.
25a0607 to
eb45d5c
Compare
Author
|
Reorganizing PR sequence for coherent implementation order. This content will be included in the new PR series. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add process identification and linking primitives inspired by Erlang/OTP.
Changes
Pidtype for unique process identificationExitReasonenum for process termination reasonsHasPidtrait for types that have a process identifierPR Chain
This is PR 2 of 6:
Depends on: #74