mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-06-10 16:47:14 +00:00
* Make ThreadPool ctor exception-safe on partial thread creation If std::thread construction throws partway through the ThreadPool constructor (e.g., pthread_create returns EAGAIN under thread-resource pressure), the partially-built threads_ vector would destruct joinable std::thread objects, calling std::terminate(). Wrap the spawn loop and, on failure, signal shutdown to the workers already created, join them, and rethrow. Adds a reproducer test in test_thread_pool.cc that interposes pthread_create at link time to deterministically fail the second call, gated to POSIX + exceptions-enabled builds. Fix #2444 * Strip ASAN from test_thread_pool to coexist with pthread_create override Linux libasan installs its own pthread_create interceptor; our in-binary symbol override sits on top of it and corrupts ASAN's thread bookkeeping, which surfaces as "Joining already joined thread" on the very first test. Disable ASAN for this small unit-test binary -- ThreadPool memory behavior is still exercised under ASAN by the main `test` binary.
7.5 KiB
7.5 KiB