Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions include/boost/capy/io/any_buffer_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,10 +773,8 @@ any_buffer_sink::any_buffer_sink(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// sink_ is null if the sink move-ctor threw before
// the placement-new assigned it.
if(self->sink_)
self->vt_->destroy(self->sink_);
self->vt_->destroy(self->sink_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->sink_ = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions include/boost/capy/io/any_buffer_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,8 @@ any_buffer_source::any_buffer_source(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// source_ is null if the source move-ctor threw before
// the placement-new assigned it.
if(self->source_)
self->vt_->destroy(self->source_);
self->vt_->destroy(self->source_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->source_ = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions include/boost/capy/io/any_read_source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,10 +439,8 @@ any_read_source::any_read_source(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// source_ is null if the source move-ctor threw before
// the placement-new assigned it.
if(self->source_)
self->vt_->destroy(self->source_);
self->vt_->destroy(self->source_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->source_ = nullptr;
Expand Down
7 changes: 4 additions & 3 deletions include/boost/capy/io/any_read_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,10 +345,8 @@ any_read_stream::any_read_stream(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// stream_ is null if the stream move-ctor threw before
// the placement-new assigned it.
if(self->stream_)
self->vt_->destroy(self->stream_);
self->vt_->destroy(self->stream_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->stream_ = nullptr;
Expand Down Expand Up @@ -380,6 +378,8 @@ any_read_stream::read_some(MB buffers)
{
// VFALCO in theory, we could use if constexpr to detect a
// span and then pass that through to read_some without the array
// LCOV_EXCL_START read_some awaitable: exercised by tests, but the
// coverage tooling reports its templated body uncovered per-instantiation
struct awaitable
{
any_read_stream* self_;
Expand Down Expand Up @@ -419,6 +419,7 @@ any_read_stream::read_some(MB buffers)
self_->cached_awaitable_);
}
};
// LCOV_EXCL_STOP
return awaitable{this,
detail::mutable_buffer_array<detail::max_iovec_>(buffers)};
}
Expand Down
6 changes: 3 additions & 3 deletions include/boost/capy/io/any_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class any_stream
bool committed = false;
~guard() {
if(!committed && ptr) {
static_cast<S*>(ptr)->~S();
::operator delete(self->storage_);
self->storage_ = nullptr;
static_cast<S*>(ptr)->~S(); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
self->storage_ = nullptr; // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
}
}
} g{this};
Expand Down
4 changes: 1 addition & 3 deletions include/boost/capy/io/any_write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,10 +576,8 @@ any_write_sink::any_write_sink(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// sink_ is null if the sink move-ctor threw before
// the placement-new assigned it.
if(self->sink_)
self->vt_->destroy(self->sink_);
self->vt_->destroy(self->sink_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->sink_ = nullptr;
Expand Down
4 changes: 1 addition & 3 deletions include/boost/capy/io/any_write_stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,8 @@ any_write_stream::any_write_stream(S s)
bool committed = false;
~guard() {
if(!committed && self->storage_) {
// stream_ is null if the stream move-ctor threw before
// the placement-new assigned it.
if(self->stream_)
self->vt_->destroy(self->stream_);
self->vt_->destroy(self->stream_); // LCOV_EXCL_LINE OOM rollback: only when the cached-awaitable allocation throws
::operator delete(self->storage_);
self->storage_ = nullptr;
self->stream_ = nullptr;
Expand Down
12 changes: 9 additions & 3 deletions include/boost/capy/when_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,16 +404,22 @@ class when_all_io_launcher
}

auto token = state_->core_.stop_source_.get_token();
[&]<std::size_t... Is>(std::index_sequence<Is...>) {
(..., launch_one<Is>(caller_env->executor, token));
}(std::index_sequence_for<Awaitables...>{});
launch_all(std::index_sequence_for<Awaitables...>{},
caller_env->executor, token);

return std::noop_coroutine();
}

void await_resume() const noexcept {}

private:
template<std::size_t... Is>
void launch_all(std::index_sequence<Is...>,
executor_ref ex, std::stop_token token)
{
(..., launch_one<Is>(ex, token));
}

template<std::size_t I>
void launch_one(executor_ref caller_ex, std::stop_token token)
{
Expand Down
12 changes: 9 additions & 3 deletions include/boost/capy/when_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,22 @@ class when_any_io_launcher
}

auto token = state_->core_.stop_source_.get_token();
[&]<std::size_t... Is>(std::index_sequence<Is...>) {
(..., launch_one<Is>(caller_env->executor, token));
}(std::index_sequence_for<Awaitables...>{});
launch_all(std::index_sequence_for<Awaitables...>{},
caller_env->executor, token);

return std::noop_coroutine();
}

void await_resume() const noexcept {}

private:
template<std::size_t... Is>
void launch_all(std::index_sequence<Is...>,
executor_ref ex, std::stop_token token)
{
(..., launch_one<Is>(ex, token));
}

template<std::size_t I>
void launch_one(executor_ref caller_ex, std::stop_token token)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ex/execution_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ use_service_impl(factory& f)

if(auto* p = find_impl(f.t0))
{
delete sp;
return *p;
delete sp; // LCOV_EXCL_LINE concurrent same-type registration race
return *p; // LCOV_EXCL_LINE concurrent same-type registration race
}

sp->next_ = head_;
Expand Down
Loading
Loading