• 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

93.55
/libs/core/threading_base/src/create_work.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_work.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
namespace hpx { namespace threads { namespace detail {
17

18
    thread_id_ref_type create_work(policies::scheduler_base* scheduler,
4,730,757✔
19
        threads::thread_init_data& data, error_code& ec)
20
    {
21
        // verify parameters
22
        switch (data.initial_state)
4,730,771✔
23
        {
24
        case thread_schedule_state::pending:
25
        case thread_schedule_state::pending_do_not_schedule:
26
        case thread_schedule_state::pending_boost:
27
        case thread_schedule_state::suspended:
28
            break;
4,730,771✔
29

30
        default:
31
        {
32
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
×
33
                "thread::detail::create_work", "invalid initial state: {}",
34
                data.initial_state);
35
            return invalid_thread_id;
×
36
        }
37
        }
38

39
#ifdef HPX_HAVE_THREAD_DESCRIPTION
40
        if (!data.description)
41
        {
42
            HPX_THROWS_IF(ec, hpx::error::bad_parameter,
43
                "thread::detail::create_work", "description is nullptr");
44
            return invalid_thread_id;
45
        }
46
#endif
47

48
        LTM_(info)
9,452,147✔
49
            .format("create_work: pool({}), scheduler({}), initial_state({}), "
9,442,825✔
50
                    "thread_priority({})",
51
                *scheduler->get_parent_pool(), *scheduler,
4,721,449✔
52
                get_thread_state_name(data.initial_state),
4,721,411✔
53
                get_thread_priority_name(data.priority))
4,721,382✔
54
#ifdef HPX_HAVE_THREAD_DESCRIPTION
55
            .format(", description({})", data.description)
56
#endif
57
            ;
58

59
        thread_self* self = get_self_ptr();
4,730,944✔
60

61
#ifdef HPX_HAVE_THREAD_PARENT_REFERENCE
62
        if (nullptr == data.parent_id)
63
        {
64
            if (self)
65
            {
66
                data.parent_id = get_thread_id_data(self->get_thread_id());
67
                data.parent_phase = self->get_thread_phase();
68
            }
69
        }
70
        if (0 == data.parent_locality_id)
71
            data.parent_locality_id = detail::get_locality_id(hpx::throws);
72
#endif
73

74
        if (nullptr == data.scheduler_base)
4,730,944✔
75
            data.scheduler_base = scheduler;
4,730,944✔
76

77
        // Pass critical priority from parent to child.
78
        if (self)
4,730,944✔
79
        {
80
            if (data.priority == thread_priority::default_ &&
7,391,762✔
81
                thread_priority::high_recursive ==
3,421,094✔
82
                    get_thread_id_data(self->get_thread_id())->get_priority())
3,421,094✔
83
            {
84
                data.priority = thread_priority::high_recursive;
10,573✔
85
            }
10,573✔
86
        }
3,970,668✔
87

88
        // create the new thread
89
        if (data.priority == thread_priority::default_)
4,730,942✔
90
            data.priority = thread_priority::normal;
4,170,489✔
91

92
        data.run_now = (thread_priority::high == data.priority ||
9,439,895✔
93
            thread_priority::high_recursive == data.priority ||
4,708,953✔
94
            thread_priority::bound == data.priority ||
4,698,171✔
95
            thread_priority::boost == data.priority);
4,696,084✔
96

97
        thread_id_ref_type id = invalid_thread_id;
4,730,943✔
98
        scheduler->create_thread(data, data.run_now ? &id : nullptr, ec);
4,730,942✔
99

100
        // NOTE: Don't care if the hint is a NUMA hint, just want to wake up a
101
        // thread.
102
        scheduler->do_some_work(data.schedulehint.hint);
4,730,942✔
103

104
        return id;
4,730,945✔
105
    }
4,730,942✔
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