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

jbaldwin / libcoro / 13039320867

29 Jan 2025 07:54PM UTC coverage: 84.886%. First build
13039320867

Pull #288

github

web-flow
Merge 49829ea21 into 26de94ded
Pull Request #288: coro::task_container gc fix not completing coroutines

41 of 59 new or added lines in 6 files covered. (69.49%)

1376 of 1621 relevant lines covered (84.89%)

4304963.72 hits per line

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

57.89
/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()
400,505✔
9
{
10

11
}
400,505✔
12

13
promise_self_destroying::~promise_self_destroying()
400,505✔
14
{
15

16
}
400,505✔
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
400,505✔
35
{
36
    return task_self_destroying{*this};
400,505✔
37
}
38

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

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

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

56
auto promise_self_destroying::return_void() noexcept -> void
400,505✔
57
{
58
    // no-op
59
}
400,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
auto promise_self_destroying::task_container_size(std::atomic<std::size_t>& task_container_size) -> void
400,505✔
67
{
68
    m_task_container_size = &task_container_size;
400,505✔
69
}
400,505✔
70

71
task_self_destroying::task_self_destroying(promise_self_destroying& promise)
400,505✔
72
    : m_promise(&promise)
400,505✔
73
{
74

75
}
400,505✔
76

77
task_self_destroying::~task_self_destroying()
400,504✔
78
{
79

80
}
400,504✔
81

NEW
82
task_self_destroying::task_self_destroying(task_self_destroying&& other)
×
NEW
83
    : m_promise(other.m_promise)
×
84
{
85

NEW
86
}
×
87

NEW
88
auto task_self_destroying::operator=(task_self_destroying&& other) -> task_self_destroying&
×
89
{
NEW
90
    if (std::addressof(other) != this)
×
91
    {
NEW
92
        m_promise = other.m_promise;
×
93
    }
94

NEW
95
    return *this;
×
96
}
97

98
} // 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