feat: Phase 10 — std::shared_mutex для read-only методов - #25
Merged
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: netkeep80#5
Replace std::recursive_mutex with std::shared_mutex to enable parallel readers (validate, save, dump_stats) while keeping exclusive write access for allocate, deallocate, create, load, destroy. Key changes: - include/persist_memory_manager.h: swap recursive_mutex → shared_mutex; write methods use unique_lock, read methods use shared_lock; refactor reallocate() to release lock before calling allocate/deallocate (avoids deadlock with non-recursive shared_mutex); version → 0.8.0 - tests/test_shared_mutex.cpp: 4 tests — concurrent validate, readers + writers, reallocate correctness, concurrent get_stats - tests/CMakeLists.txt: add test_shared_mutex target - phase10.md: documentation for Phase 10 - plan.md, README.md: updated to reflect Phase 10 completion File size: 1499 lines (CI limit ≤ 1500 ✅) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard
marked this pull request as ready for review
March 1, 2026 07:14
This reverts commit 1fd1336.
Contributor
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
🔄 Auto-restart triggeredReason: CI failures detected Starting new session to address the issues. Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable. |
Multi-threaded tests in test_shared_mutex.cpp cause non-atomic gcov counters to overflow and go negative, making lcov fail with: geninfo: ERROR: Unexpected negative count for test_shared_mutex.cpp:128 Adding -fprofile-update=atomic ensures counter increments are atomic, preventing wrap-around in concurrent test scenarios. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
🔄 Auto-restart-until-mergeable Log (iteration 1)This log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
Now working session is ended, feel free to review and add any feedback on the solution draft. |
Contributor
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
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
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.
Что реализовано
Решает задачу из issue #5: реализована следующая задача текущей фазы плана — Фаза 10: std::shared_mutex.
Суть изменений
Переход с
std::recursive_mutexнаstd::shared_mutex:create,load,destroy,allocate,deallocate)std::unique_lock<std::shared_mutex>validate,save,dump_stats)std::shared_lock<std::shared_mutex>Ключевые изменения
include/persist_memory_manager.hstd::recursive_mutex→std::shared_mutex(версия0.7.0→0.8.0)lock_guard<recursive_mutex>→unique_lock<shared_mutex>validate,save,dump_stats): добавленshared_lock<shared_mutex>reallocate()рефакторирован: вызываетlock.unlock()передallocate()/deallocate()— устраняет deadlock с нерекурсивным мьютексом. Попутно сокращён с 41 до 35 строк.tests/test_shared_mutex.cpp(новый, 313 строк)4 теста:
test_concurrent_validate— 8 потоков параллельно вызываютvalidate()(shared_lock)test_readers_writers— 4 читателя + 2 писателя одновременноtest_reallocate_correctness— корректность данных при параллельномreallocatetest_concurrent_get_stats— согласованность счётчиков при параллельномget_statsДокументация
phase10.md— документация по Фазе 10plan.md— добавлена Фаза 10 (статус: ✅ Завершена)README.md— обновлено описание возможностей и структура репозиторияРезультаты CI
test_shared_mutex)clang-formatбез нарушенийcppcheckбез предупрежденийFixes #5