• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

STEllAR-GROUP / hpx / #882

31 Aug 2023 07:44PM UTC coverage: 41.798% (-44.7%) from 86.546%
#882

push

19442 of 46514 relevant lines covered (41.8%)

126375.38 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/libs/core/io_service/src/io_service_thread_pool.cpp
1
//  Copyright (c) 2017-2023 Hartmut Kaiser
2
//
3
//  SPDX-License-Identifier: BSL-1.0
4
//  Distributed under the Boost Software License, Version 1.0. (See accompanying
5
//  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6

7
#include <hpx/config.hpp>
8
#include <hpx/assert.hpp>
9
#include <hpx/io_service/io_service_pool.hpp>
10
#include <hpx/io_service/io_service_thread_pool.hpp>
11
#include <hpx/modules/affinity.hpp>
12
#include <hpx/modules/concurrency.hpp>
13

14
#include <cstddef>
15
#include <exception>
16

17
namespace hpx::threads::detail {
18

19
    io_service_thread_pool::io_service_thread_pool(
×
20
        hpx::threads::thread_pool_init_parameters const& init)
×
21
      : thread_pool_base(init)
22
      , threads_(std::make_unique<util::io_service_pool>(
×
23
            init.notifier_, init.name_.c_str()))
×
24
    {
25
    }
×
26

27
    hpx::state io_service_thread_pool::get_state() const
×
28
    {
29
        return hpx::state::stopped;
×
30
    }
31

32
    hpx::state io_service_thread_pool::get_state(
×
33
        std::size_t /* num_thread */) const
34
    {
35
        return hpx::state::stopped;
×
36
    }
37

38
    bool io_service_thread_pool::has_reached_state(hpx::state /* s */) const
×
39
    {
40
        return true;
×
41
    }
42

43
    ///////////////////////////////////////////////////////////////////////////
44
    void io_service_thread_pool::create_thread(thread_init_data& /* data */,
×
45
        thread_id_ref_type& /* id */, error_code& /* ec */)
46
    {
47
    }
×
48

49
    thread_id_ref_type io_service_thread_pool::create_work(
×
50
        thread_init_data& /* data */, error_code& /* ec */)
51
    {
52
        return invalid_thread_id;
×
53
    }
54

55
    threads::thread_state io_service_thread_pool::set_state(
×
56
        thread_id_type const& /* id */, thread_schedule_state /* new_state */,
57
        thread_restart_state /* new_state_ex */, thread_priority /* priority */,
58
        error_code& /* ec */)
59
    {
60
        return threads::thread_state(threads::thread_schedule_state::terminated,
61
            threads::thread_restart_state::unknown);
×
62
    }
63

64
    threads::thread_id_ref_type io_service_thread_pool::set_state(
×
65
        hpx::chrono::steady_time_point const& /* abs_time */,
66
        thread_id_type const& id, thread_schedule_state /* newstate */,
67
        thread_restart_state /* newstate_ex */, thread_priority /* priority */,
68
        error_code& /* ec */)
69
    {
70
        return id;
×
71
    }
72

73
    bool io_service_thread_pool::report_error(
×
74
        std::size_t /* num */, std::exception_ptr const& /* e */)
75
    {
76
        return false;
×
77
    }
78

79
    ///////////////////////////////////////////////////////////////////////////
80
    bool io_service_thread_pool::run(
×
81
        [[maybe_unused]] std::unique_lock<std::mutex>& l,
82
        std::size_t num_threads)
83
    {
84
        HPX_ASSERT(l.owns_lock());
85
        util::barrier startup(1);
×
86
        return threads_->run(num_threads, false, &startup);
×
87
    }
×
88

89
    void io_service_thread_pool::stop(
×
90
        std::unique_lock<std::mutex>& /* l */, bool /* blocking = true */)
91
    {
92
    }
×
93

94
    void io_service_thread_pool::resume_direct(error_code& /* ec */)
×
95
    {
96
        HPX_ASSERT_MSG(
97
            false, "Resuming io_service_thread_pool is not supported");
98
    }
×
99

100
    void io_service_thread_pool::suspend_direct(error_code& /* ec */)
×
101
    {
102
        HPX_ASSERT_MSG(
103
            false, "Suspending io_service_thread_pool is not supported");
104
    }
×
105

106
    void io_service_thread_pool::suspend_processing_unit_direct(
×
107
        std::size_t /* virt_core */, error_code& /* ec */)
108
    {
109
        HPX_ASSERT_MSG(false,
110
            "Suspending threads on io_service_thread_pool is not "
111
            "supported");
112
    }
×
113

114
    void io_service_thread_pool::resume_processing_unit_direct(
×
115
        std::size_t /* virt_core */, error_code& /* ec */)
116
    {
117
        HPX_ASSERT_MSG(false,
118
            "Suspending threads on io_service_thread_pool is not "
119
            "supported");
120
    }
×
121

122
    std::thread& io_service_thread_pool::get_os_thread_handle(
×
123
        std::size_t global_thread_num)
124
    {
125
        return threads_->get_os_thread_handle(
×
126
            global_thread_num - this->thread_offset_);
×
127
    }
128

129
    std::size_t io_service_thread_pool::get_os_thread_count() const
×
130
    {
131
        return threads_->size();
×
132
    }
133
}    // namespace hpx::threads::detail
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc