Skip to content

feat: add policy-based worker and spin_lock data structure#3

Open
xcrtp wants to merge 5 commits intomainfrom
feature/policy-based-worker-and-spin-lock
Open

feat: add policy-based worker and spin_lock data structure#3
xcrtp wants to merge 5 commits intomainfrom
feature/policy-based-worker-and-spin-lock

Conversation

@xcrtp
Copy link
Copy Markdown
Owner

@xcrtp xcrtp commented Feb 25, 2026

Summary

  • Refactor Worker to PolicyThreadWorker<Policy> template for flexible task policies
  • Add functional_task_policy and pointer_task_policy in types.hpp
  • Add spin_lock implementation with configurable spin count policy in xcoroutine/structure/spin_lock.hpp
  • Add comprehensive unit tests for spin_lock in test/spin_lock.cc
  • Rename tests/ to test/ directory

Test plan

  • Build passes: cmake --build . --config Debug
  • All tests pass: ctest -C Debug --output-on-failure
  • Run spin_lock tests: ./build/test/test_spin_lock.exe

xcrtp and others added 5 commits February 25, 2026 18:31
- Refactor Worker to PolicyThreadWorker<Policy> template for flexible task policies
- Add functional_task_policy and pointer_task_policy in types.hpp
- Add spin_lock implementation with configurable spin count policy
- Add comprehensive unit tests for spin_lock
- Rename tests/ to test/ directory
Add three workflow files based on xcmixin's CI configuration:
- ci.yml: Build and test on Ubuntu, macOS, Windows with clang/gcc
- code-quality.yml: Clang format checking
- release.yml: Automated release creation on tag push

Also update .gitignore to allow .github directory.
…xamples

- Add clang-format installation on all platforms (Linux, macOS, Windows)
- Add ninja installation on macOS
- Add conditional check for examples directory existence
- Format code to pass clang-format check
- Add clang-format to macOS brew install command
- Use llvm package on Windows instead of non-existent clang-format package
- Remove wait_until_unlock method from spin_lock, use lock() instead
- Change memory_order from acquire to acq_rel for try_lock
- Add notify_one() call in unlock() to wake waiters
- Move task_t definition to public section in worker
- Add type aliases (Worker, task_t, worker_ptr) in scheduler
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.

1 participant