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

jbaldwin / libcoro / 13038444258

29 Jan 2025 06:59PM UTC coverage: 84.207%. First build
13038444258

Pull #288

github

web-flow
Merge 22fe37d57 into 86740cc7e
Pull Request #288: coro::task_container gc fix not completing coroutines

36 of 54 new or added lines in 5 files covered. (66.67%)

1365 of 1621 relevant lines covered (84.21%)

4291288.4 hits per line

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

54.29
/src/detail/task_self_destroying.cpp
1
#include "coro/detail/task_self_destroying.hpp"
2

3
#include <utility>
4

5
namespace coro::detail
6
{
7

8
promise_self_destroying::promise_self_destroying()
200,505✔
9
{
10

11
}
200,505✔
12

13
promise_self_destroying::~promise_self_destroying()
200,504✔
14
{
15

16
}
200,504✔
17

NEW
18
promise_self_destroying::promise_self_destroying(promise_self_destroying&& other)
×
NEW
19
    : m_task_container_size(std::exchange(other.m_task_container_size, nullptr))
×
20
{
21

NEW
22
}
×
23

NEW
24
auto promise_self_destroying::operator=(promise_self_destroying&& other) -> promise_self_destroying&
×
25
{
NEW
26
    if (std::addressof(other) != nullptr)
×
27
    {
NEW
28
        m_task_container_size = std::exchange(other.m_task_container_size, nullptr);
×
29
    }
30

NEW
31
    return *this;
×
32
}
33

34
auto promise_self_destroying::get_return_object() -> task_self_destroying
200,505✔
35
{
36
    return task_self_destroying{*this};
200,505✔
37
}
38

39
auto promise_self_destroying::initial_suspend() -> std::suspend_always
200,505✔
40
{
41
    return std::suspend_always{};
200,505✔
42
}
43

44
auto promise_self_destroying::final_suspend() noexcept -> std::suspend_never
200,505✔
45
{
46
    // Notify the task_container<executor_t> that this coroutine has completed.
47
    if (m_task_container_size != nullptr)
200,505✔
48
    {
49
        m_task_container_size->fetch_sub(1);
200,505✔
50
    }
51

52
    // By not suspending this lets the coroutine destroy itself.
53
    return std::suspend_never{};
200,505✔
54
}
55

56
auto promise_self_destroying::return_void() noexcept -> void
200,505✔
57
{
58
    // no-op
59
}
200,505✔
60

NEW
61
auto promise_self_destroying::unhandled_exception() -> void
×
62
{
63
    // The user cannot access the promise anyways, ignore the exception.
NEW
64
}
×
65

66
task_self_destroying::task_self_destroying(promise_self_destroying& promise)
200,505✔
67
    : m_promise(&promise)
200,505✔
68
{
69

70
}
200,505✔
71

72
task_self_destroying::~task_self_destroying()
200,505✔
73
{
74

75
}
200,505✔
76

NEW
77
task_self_destroying::task_self_destroying(task_self_destroying&& other)
×
NEW
78
    : m_promise(other.m_promise)
×
79
{
80

NEW
81
}
×
82

NEW
83
auto task_self_destroying::operator=(task_self_destroying&& other) -> task_self_destroying&
×
84
{
NEW
85
    if (std::addressof(other) != this)
×
86
    {
NEW
87
        m_promise = other.m_promise;
×
88
    }
89

NEW
90
    return *this;
×
91
}
92

93
} // namespace coro::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