feat: basic implementation#1
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements the foundational structure for the synchrony library, which provides both synchronous (multithreaded) and asynchronous (single-threaded) versions of common synchronization primitives. The implementation uses a clever pattern where primitives are organized into sync and unsync modules, allowing library authors to easily switch between multithreaded and single-threaded implementations based on feature flags.
Key changes include:
- Implementation of core synchronization primitives (Mutex, BiLock, AtomicTypes, WakerSlot, Event, Flag)
- Module structure with sync/unsync variants using macros for code generation
- Development tooling setup (CI workflows, formatting, commit linting)
Reviewed changes
Copilot reviewed 22 out of 26 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib.rs | Main library entry point with module exports and usage examples |
| src/waker_slot.rs | Waker slot implementation for task wakeup in both sync and unsync variants |
| src/shared.rs | Type aliases for shared pointers (Arc/Rc) |
| src/mutex_blocking.rs | Blocking mutex wrappers for both sync and unsync variants |
| src/mutex/mod.rs | Async mutex implementation using macros to generate sync/unsync versions |
| src/mutex/unsync.rs | Tests for mutex guard debug formatting |
| src/flag.rs | Boolean flag abstraction with atomic operations |
| src/event.rs | Event notification primitives wrapping external libraries |
| src/bilock/mod.rs | BiLock (two-party lock) implementation |
| src/atomic/mod.rs | Atomic scalar type re-exports and module definitions |
| src/atomic/unsync.rs | Single-threaded atomic type implementations using Cell |
| Cargo.toml | Package metadata, dependencies, and feature flags |
| README.md | Library documentation and feature list |
| .gitignore | Git ignore patterns for build artifacts and editor files |
| .envrc | Direnv configuration file |
| .direnv/bin/nix-direnv-reload | Auto-generated direnv script with hardcoded paths |
| rustfmt.toml | Code formatting configuration |
| flake.nix | Nix development environment configuration |
| flake.lock | Nix flake lock file |
| .github/workflows/* | CI workflow definitions for formatting, linting, and checking |
| .github/dependabot.yml | Dependabot configuration |
| .commitlintrc.json | Commit message linting configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Berrysoft
left a comment
There was a problem hiding this comment.
LGTM. I think we should add tests for the sync types to make sure that they are Send + Sync. Maybe a next PR.
Yeah sounds good. |
No description provided.