Skip to content

Commit

Permalink
promise_core, multipromise: clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
dermesser committed Oct 8, 2024
1 parent 6afacfc commit 4ad12f1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
5 changes: 0 additions & 5 deletions uvco/loop/scheduler.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// uvco (c) 2023 Lewin Bormann. See LICENSE for specific terms.

#include <array>
#include <fmt/core.h>
#include <uv.h>

#include "uvco/loop/scheduler.h"

#include <algorithm>
#include <coroutine>
#include <cstddef>
#include <span>

namespace uvco {
Expand Down Expand Up @@ -44,9 +42,6 @@ void Scheduler::runAll() {
// filter, because it takes fewer calculations and is a nice linear search
// over a usually short vector.
if (findFirstIndexOf(resumableRunning_, coro) == i) {
// This is only true if the coroutine is a false positive in the bloom
// filter, and has not been run before. The linear search is slow (but
// not too slow), and only happens in the case of a false positive.
coro.resume();
}
}
Expand Down
2 changes: 2 additions & 0 deletions uvco/promise/multipromise.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// uvco (c) 2024 Lewin Bormann. See LICENSE for specific terms.

#include "uvco/promise/multipromise.h"

namespace uvco {}
5 changes: 1 addition & 4 deletions uvco/promise/multipromise.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// uvco (c) 2024 Lewin Bormann. See LICENSE for specific terms.

#pragma once

Expand Down Expand Up @@ -54,10 +55,6 @@ template <typename T> class MultiPromiseCore : public PromiseCore<T> {
PromiseCore<T>::state_ = PromiseState::waitedOn;
}

/// See `Promise::resume`. Implemented here to provide a distinction in stack
/// traces.
void resume() override { PromiseCore<T>::resume(); }

/// Resume the generator from its last `co_yield` point, so it can yield the
/// next value.
///
Expand Down
2 changes: 1 addition & 1 deletion uvco/promise/promise_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ template <typename T> class PromiseCore : public RefCounted<PromiseCore<T>> {
/// enqueuing it in the global event loop.
///
/// A promise core can only be resumed once.
virtual void resume() {
void resume() {
if (handle_) {
BOOST_ASSERT(state_ == PromiseState::waitedOn);
state_ = PromiseState::resuming;
Expand Down

0 comments on commit 4ad12f1

Please sign in to comment.