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

STEllAR-GROUP / hpx / #853

19 Dec 2022 01:01AM UTC coverage: 86.287% (+0.4%) from 85.912%
#853

push

StellarBot
Merge #6109

6109: Modernize serialization module r=hkaiser a=hkaiser

- flyby separate serialization of Boost types

working towards https://github.com/STEllAR-GROUP/hpx/issues/5497

Co-authored-by: Hartmut Kaiser <hartmut.kaiser@gmail.com>

53 of 53 new or added lines in 6 files covered. (100.0%)

173939 of 201582 relevant lines covered (86.29%)

1931657.12 hits per line

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

92.0
/libs/core/threading_base/src/create_thread.cpp
1
//  Copyright (c) 2007-2021 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/modules/coroutines.hpp>
9
#include <hpx/modules/errors.hpp>
10
#include <hpx/modules/logging.hpp>
11
#include <hpx/threading_base/create_thread.hpp>
12
#include <hpx/threading_base/scheduler_base.hpp>
13
#include <hpx/threading_base/thread_data.hpp>
14
#include <hpx/threading_base/thread_init_data.hpp>
15

16
#include <cstddef>
17

18
namespace hpx { namespace threads { namespace detail {
19

20
    void create_thread(policies::scheduler_base* scheduler,
484,945✔
21
        threads::thread_init_data& data, threads::thread_id_ref_type& id,
22
        error_code& ec)
23
    {
24
        // verify parameters
25
        switch (data.initial_state)
484,947✔
26
        {
472,391✔
27
        // NOLINTNEXTLINE(bugprone-branch-clone)
28
        case thread_schedule_state::pending:
29
            [[fallthrough]];
30
        case thread_schedule_state::pending_do_not_schedule:
31
            [[fallthrough]];
32
        case thread_schedule_state::pending_boost:
33
            [[fallthrough]];
34
        case thread_schedule_state::suspended:
35
            break;
484,947✔
36

37
        default:
38
        {
39
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
40
                "threads::detail::create_thread", "invalid initial state: {}",
41
                data.initial_state);
42
            return;
×
43
        }
44
        }
45

46
#ifdef HPX_HAVE_THREAD_DESCRIPTION
47
        if (!data.description)
48
        {
49
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
50
                "threads::detail::create_thread", "description is nullptr");
51
            return;
52
        }
53
#endif
54

55
        thread_self* self = get_self_ptr();
484,942✔
56

57
#ifdef HPX_HAVE_THREAD_PARENT_REFERENCE
58
        if (nullptr == data.parent_id)
59
        {
60
            if (self)
61
            {
62
                data.parent_id = get_thread_id_data(threads::get_self_id());
63
                data.parent_phase = self->get_thread_phase();
64
            }
65
        }
66
        if (0 == data.parent_locality_id)
67
            data.parent_locality_id = detail::get_locality_id(hpx::throws);
68
#endif
69

70
        if (nullptr == data.scheduler_base)
484,942✔
71
            data.scheduler_base = scheduler;
484,943✔
72

73
        // Pass critical priority from parent to child (but only if there is
74
        // none is explicitly specified).
75
        if (self)
484,944✔
76
        {
77
            if (data.priority == thread_priority::default_ &&
54,694✔
78
                thread_priority::high_recursive ==
14,593✔
79
                    get_thread_id_data(threads::get_self_id())->get_priority())
14,593✔
80
            {
81
                data.priority = thread_priority::high_recursive;
2✔
82
            }
2✔
83
        }
40,102✔
84

85
        if (data.priority == thread_priority::default_)
484,941✔
86
            data.priority = thread_priority::normal;
14,591✔
87

88
        // create the new thread
89
        scheduler->create_thread(data, &id, ec);
484,980✔
90

91
        // NOLINTNEXTLINE(bugprone-branch-clone)
92
        LTM_(info)
969,836✔
93
            .format("create_thread: pool({}), scheduler({}), thread({}), "
969,793✔
94
                    "initial_state({}), run_now({})",
95
                *scheduler->get_parent_pool(), *scheduler, id,
484,898✔
96
                get_thread_state_name(data.initial_state), data.run_now)
484,895✔
97
#ifdef HPX_HAVE_THREAD_DESCRIPTION
98
            .format(", description({})", data.description)
99
#endif
100
            ;
101

102
        // NOTE: Don't care if the hint is a NUMA hint, just want to wake up a
103
        // thread.
104
        scheduler->do_some_work(data.schedulehint.hint);
484,980✔
105
    }
484,980✔
106
}}}    // 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

© 2025 Coveralls, Inc