forked from OctaForge/libostd
yields are noexcept
This commit is contained in:
parent
c1e0ae56ac
commit
73c4dd6cbf
|
@ -29,7 +29,7 @@ struct scheduler {
|
||||||
scheduler &operator=(scheduler &&) = delete;
|
scheduler &operator=(scheduler &&) = delete;
|
||||||
|
|
||||||
virtual void spawn(std::function<void()>) = 0;
|
virtual void spawn(std::function<void()>) = 0;
|
||||||
virtual void yield() = 0;
|
virtual void yield() noexcept = 0;
|
||||||
virtual generic_condvar make_condition() = 0;
|
virtual generic_condvar make_condition() = 0;
|
||||||
|
|
||||||
template<typename F, typename ...A>
|
template<typename F, typename ...A>
|
||||||
|
@ -100,7 +100,7 @@ struct thread_scheduler: scheduler {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() noexcept {
|
||||||
std::this_thread::yield();
|
std::this_thread::yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ namespace detail {
|
||||||
this->rethrow();
|
this->rethrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() noexcept {
|
||||||
/* we'll yield back to the thread we were scheduled to, which
|
/* we'll yield back to the thread we were scheduled to, which
|
||||||
* will appropriately notify one or all other waiting threads
|
* will appropriately notify one or all other waiting threads
|
||||||
* so we either get re-scheduled or the whole scheduler dies
|
* so we either get re-scheduled or the whole scheduler dies
|
||||||
|
@ -174,11 +174,11 @@ namespace detail {
|
||||||
this->yield_jump();
|
this->yield_jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dead() const {
|
bool dead() const noexcept {
|
||||||
return this->is_dead();
|
return this->is_dead();
|
||||||
}
|
}
|
||||||
|
|
||||||
static csched_task *current() {
|
static csched_task *current() noexcept {
|
||||||
return current_csched_task;
|
return current_csched_task;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ public:
|
||||||
p_coros.emplace_back(std::move(func), p_stacks.get_allocator());
|
p_coros.emplace_back(std::move(func), p_stacks.get_allocator());
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() noexcept {
|
||||||
detail::csched_task::current()->yield();
|
detail::csched_task::current()->yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,15 +337,15 @@ private:
|
||||||
p_func();
|
p_func();
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() noexcept {
|
||||||
p_func.yield();
|
p_func.yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool dead() const {
|
bool dead() const noexcept {
|
||||||
return p_func.dead();
|
return p_func.dead();
|
||||||
}
|
}
|
||||||
|
|
||||||
static task *current() {
|
static task *current() noexcept {
|
||||||
return reinterpret_cast<task *>(detail::csched_task::current());
|
return reinterpret_cast<task *>(detail::csched_task::current());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -434,7 +434,7 @@ public:
|
||||||
p_cond.notify_one();
|
p_cond.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void yield() {
|
void yield() noexcept {
|
||||||
task::current()->yield();
|
task::current()->yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ inline void spawn(F &&func, A &&...args) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void yield() {
|
inline void yield() noexcept {
|
||||||
detail::current_scheduler->yield();
|
detail::current_scheduler->yield();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue