Skip to content

Add explicit standard library headers to Threading.cpp#105

Merged
jke000 merged 1 commit intoBS_thread_poolfrom
copilot/sub-pr-102
Feb 11, 2026
Merged

Add explicit standard library headers to Threading.cpp#105
jke000 merged 1 commit intoBS_thread_poolfrom
copilot/sub-pr-102

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Threading.cpp uses std::make_unique, std::unique_ptr, std::unique_lock, and std::lock_guard but relied on transitive includes rather than explicitly including the required headers.

Changes:

  • Added #include <memory> for smart pointer utilities
  • Added #include <mutex> for mutex and lock guard types
  • Added #include <condition_variable> for condition variable support
#include "Threading.h"
#include <thread>
#include <chrono>
#include <memory>
#include <mutex>
#include <condition_variable>

This eliminates fragile dependency on transitive includes and ensures compilation is consistent across toolchains.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI mentioned this pull request Feb 11, 2026
Copilot AI changed the title [WIP] Fix issues in BS::thread_pool implementation based on feedback Add explicit standard library headers to Threading.cpp Feb 11, 2026
Copilot AI requested a review from jke000 February 11, 2026 01:39
@jke000 jke000 marked this pull request as ready for review February 11, 2026 01:49
@jke000 jke000 merged commit b3cca68 into BS_thread_pool Feb 11, 2026
1 check passed
jke000 added a commit that referenced this pull request Feb 17, 2026
* Update threading code to use BS::thread_pool.

* update Makefiles to use C++ 20

* fix typos in LICENSE

* remove NOTICE file; update windows-build.yml to use VS2022 to compile; map negative value to single worker thread

* Throw exception when ThreadPool::doJob() called before initialization (#103)

* Initial plan

* Add error handling to doJob() to prevent silent work dropping

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Complete implementation of doJob() error handling

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Remove unused thread tracking members from Threading class (#104)

* Initial plan

* Remove unused _threadMapMutex and _threads members

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Update MSToolkit/VisualStudio/extern/zlibstat.vcxproj

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update CometSearch/Threading.cpp

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update CometSearch/ThreadPool.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Initial plan (#105)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* Remove unused EndThread() function from Threading interface (#106)

* Initial plan

* Remove unused EndThread() function from Threading interface

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Remove build artifacts that were accidentally committed

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Add progressive backoff to wait_for_available_thread() (#107)

* Initial plan

* Add progressive backoff to wait_for_available_thread to reduce CPU usage

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Cap attempts counter to prevent overflow in wait_for_available_thread

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Simplify wait_for_available_thread by removing unnecessary overflow check

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Add counter cap to prevent overflow in wait_for_available_thread

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Clarify comment for counter cap in wait_for_available_thread

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Use std::min for cleaner counter cap in wait_for_available_thread

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Simplify counter logic by removing unnecessary cap

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Make backoff constants static constexpr for clarity

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Final progress update

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* Remove build artifacts that shouldn't be committed

Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>

* threadpool update; confirmed working for both VS and Linux

* remove fflush(); let the system handle buffering and flushing when writing the output files

* get rid of _codeql_detected_source_root and add it to .gitignore

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jke000 <9449681+jke000@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jke000 jke000 deleted the copilot/sub-pr-102 branch February 19, 2026 19:40
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.

2 participants