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

STEllAR-GROUP / hpx / #856

28 Dec 2022 02:00AM UTC coverage: 86.602% (+0.05%) from 86.55%
#856

push

StellarBot
Merge #6119

6119: Update CMakeLists.txt r=hkaiser a=khuck

updating the default APEX version


Co-authored-by: Kevin Huck <khuck@cs.uoregon.edu>

174566 of 201573 relevant lines covered (86.6%)

1876093.78 hits per line

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

74.07
/libs/core/coroutines/src/detail/coroutine_impl.cpp
1
//  Copyright (c) 2006, Giovanni P. Deretta
2
//  Copyright (c) 2007-2021 Hartmut Kaiser
3
//
4
//  This code may be used under either of the following two licences:
5
//
6
//  Permission is hereby granted, free of charge, to any person obtaining a copy
7
//  of this software and associated documentation files (the "Software"), to deal
8
//  in the Software without restriction, including without limitation the rights
9
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
//  copies of the Software, and to permit persons to whom the Software is
11
//  furnished to do so, subject to the following conditions:
12
//
13
//  The above copyright notice and this permission notice shall be included in
14
//  all copies or substantial portions of the Software.
15
//
16
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19
//  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
//  THE SOFTWARE. OF SUCH DAMAGE.
23
//
24
//  Or:
25
//
26
//  SPDX-License-Identifier: BSL-1.0
27
//  Distributed under the Boost Software License, Version 1.0.
28
//  (See accompanying file LICENSE_1_0.txt or copy at
29
//  http://www.boost.org/LICENSE_1_0.txt)
30

31
#include <hpx/config.hpp>
32

33
#include <hpx/assert.hpp>
34
#include <hpx/coroutines/coroutine.hpp>
35
#include <hpx/coroutines/detail/coroutine_impl.hpp>
36
#include <hpx/coroutines/detail/coroutine_stackful_self.hpp>
37

38
#include <cstddef>
39
#include <exception>
40
#include <utility>
41

42
namespace hpx::threads::coroutines::detail {
43

44
    ///////////////////////////////////////////////////////////////////////////
45
#if defined(HPX_DEBUG)
46
    coroutine_impl::~coroutine_impl()
340,578✔
47
    {
48
        HPX_ASSERT(!m_fun);    // functor should have been reset by now
340,578✔
49
    }
340,578✔
50
#endif
51

52
    void coroutine_impl::operator()() noexcept
5,755,844✔
53
    {
54
        using context_exit_status = super_type::context_exit_status;
55
        context_exit_status status =
5,755,839✔
56
            super_type::context_exit_status::not_exited;
57

58
        // yield value once the thread function has finished executing
59
        result_type result_last(
5,755,844✔
60
            thread_schedule_state::unknown, invalid_thread_id);
5,755,839✔
61

62
        // loop as long this coroutine has been rebound
63
        do
5,755,839✔
64
        {
65
#if defined(HPX_HAVE_ADDRESS_SANITIZER)
66
            finish_switch_fiber(nullptr, m_caller);
67
#endif
68
            std::exception_ptr tinfo;
5,755,769✔
69
            {
70
                coroutine_self* old_self = coroutine_self::get_self();
5,755,769✔
71
                coroutine_stackful_self self(this, old_self);
5,755,769✔
72
                reset_self_on_exit on_exit(&self, old_self);
5,755,769✔
73
                try
74
                {
75
                    result_last = m_fun(*this->args());
5,755,839✔
76
                    HPX_ASSERT(
5,755,769✔
77
                        result_last.first == thread_schedule_state::terminated);
78
                    status = super_type::context_exit_status::exited_return;
5,755,757✔
79
                }
5,755,753✔
80
                catch (...)
81
                {
82
                    status = super_type::context_exit_status::exited_abnormally;
×
83
                    tinfo = std::current_exception();
×
84
                }
×
85

86
                // Reset early as the destructors may still yield.
87
                this->reset_tss();
5,755,745✔
88
                this->reset();
5,755,753✔
89

90
                // return value to other side of the fence
91
                this->bind_result(result_last);
×
92
            }
5,755,753✔
93

94
            this->do_return(status, HPX_MOVE(tinfo));
×
95
        } while (this->m_state == super_type::context_state::running);
5,755,753✔
96

97
        // should not get here, never
98
        HPX_ASSERT(this->m_state == super_type::context_state::running);
×
99
    }
×
100
}    // namespace hpx::threads::coroutines::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