|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Tests for a ThreadPool whose worker threads cannot all be started. More...
#include <gtest/gtest.h>#include <thread_pool.H>#include <cstddef>#include <cstdlib>#include <new>#include <stdexcept>#include <thread>Go to the source code of this file.
Macros | |
| #define | ALEPH_START_FAILURE_TEST_UNDER_TSAN 0 |
Functions | |
| void * | operator new (std::size_t size) |
| void * | operator new[] (std::size_t size) |
| void * | operator new (std::size_t size, const std::nothrow_t &) noexcept |
| void * | operator new[] (std::size_t size, const std::nothrow_t &) noexcept |
| void | operator delete (void *ptr) noexcept |
| void | operator delete[] (void *ptr) noexcept |
| void | operator delete (void *ptr, std::size_t) noexcept |
| void | operator delete[] (void *ptr, std::size_t) noexcept |
| void | operator delete (void *ptr, const std::nothrow_t &) noexcept |
| void | operator delete[] (void *ptr, const std::nothrow_t &) noexcept |
| TEST (ThreadPoolStartFailure, ConstructorStopsTheStartedWorkersAndRethrows) | |
| TEST (ThreadPoolStartFailure, FailedResizeLeavesThePoolStopped) | |
Tests for a ThreadPool whose worker threads cannot all be started.
The global operator new is replaced so that one allocation of the test thread fails on demand. Starting a std::thread allocates the state of the new thread with it in libstdc++, libc++ and the MSVC STL, so a failed allocation is a worker that cannot be started, without exhausting the resources of the system. The standard does not require that allocation; the tests check it first and are skipped without it.
Definition in file thread_pool_start_failure_test.cc.
| #define ALEPH_START_FAILURE_TEST_UNDER_TSAN 0 |
Definition at line 62 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 138 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 146 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 142 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 140 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 148 of file thread_pool_start_failure_test.cc.
|
noexcept |
Definition at line 144 of file thread_pool_start_failure_test.cc.
| void * operator new | ( | std::size_t | size | ) |
Definition at line 110 of file thread_pool_start_failure_test.cc.
References Aleph::allocate(), and Aleph::size().
|
noexcept |
Definition at line 114 of file thread_pool_start_failure_test.cc.
References Aleph::allocate(), and Aleph::size().
| void * operator new[] | ( | std::size_t | size | ) |
Definition at line 112 of file thread_pool_start_failure_test.cc.
References Aleph::allocate(), and Aleph::size().
|
noexcept |
Definition at line 126 of file thread_pool_start_failure_test.cc.
References Aleph::allocate(), and Aleph::size().
| TEST | ( | ThreadPoolStartFailure | , |
| ConstructorStopsTheStartedWorkersAndRethrows | |||
| ) |
Definition at line 158 of file thread_pool_start_failure_test.cc.
References ALEPH_START_FAILURE_TEST_UNDER_TSAN, Aleph::ThreadPool::enqueue(), and Aleph::ThreadPool::num_threads().
| TEST | ( | ThreadPoolStartFailure | , |
| FailedResizeLeavesThePoolStopped | |||
| ) |
Definition at line 192 of file thread_pool_start_failure_test.cc.
References ALEPH_START_FAILURE_TEST_UNDER_TSAN, Aleph::ThreadPool::enqueue(), Aleph::ThreadPool::is_idle(), Aleph::ThreadPool::is_stopped(), Aleph::ThreadPool::num_threads(), and Aleph::ThreadPool::resize().