* @brief Check that a task is destructed immediately after it executes, and therefore does not artificially extend the lifetime of any captured objects. */
| 2698 | * @brief Check that a task is destructed immediately after it executes, and therefore does not artificially extend the lifetime of any captured objects. |
| 2699 | */ |
| 2700 | void check_task_destruct() |
| 2701 | { |
| 2702 | constexpr std::chrono::milliseconds sleep_time(20); |
| 2703 | BS::thread_pool pool; |
| 2704 | std::atomic<bool> object_exists = false; |
| 2705 | { |
| 2706 | const std::shared_ptr<detect_destruct> ptr = std::make_shared<detect_destruct>(&object_exists); |
| 2707 | pool.submit_task([ptr] {}).wait(); |
| 2708 | } |
| 2709 | std::this_thread::sleep_for(sleep_time); |
| 2710 | check(!object_exists); |
| 2711 | } |
| 2712 | |
| 2713 | /** |
| 2714 | * @brief Check that the type trait `BS::common_index_type` works as expected. |