0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-19 18:38:21 +02:00

ircd: Specify explicit noexcept for gcc-10 issue.

This commit is contained in:
Jason Volk 2020-07-11 15:28:24 -07:00
parent 2b930eb4b2
commit 6ec9b2a783
7 changed files with 47 additions and 26 deletions

View file

@ -259,7 +259,7 @@ ircd::ctx::_wait_until(const future<T> &f,
if(unlikely(is(state, future_state::INVALID)))
throw no_state{};
return state.cond.wait_until(tp, [&state]
return state.cond.wait_until(tp, [&state]() noexcept
{
return !is(state, future_state::PENDING);
});

View file

@ -97,7 +97,7 @@ ircd::ctx::mutex::lock()
assert(current);
deadlock_assertion();
q.wait([this]
q.wait([this]() noexcept
{
return !locked();
});
@ -121,7 +121,7 @@ ircd::ctx::mutex::try_lock_until(const time_point &tp)
const bool success
{
q.wait_until(tp, [this]
q.wait_until(tp, [this]() noexcept
{
return !locked();
})

View file

@ -107,7 +107,7 @@ ircd::ctx::queue<T, A>::pop()
this->w
};
d.wait([this]
d.wait([this]() noexcept
{
return !q.empty();
});
@ -131,7 +131,7 @@ ircd::ctx::queue<T, A>::pop_for(const duration &dur)
const bool ready
{
d.wait_for(dur, [this]
d.wait_for(dur, [this]() noexcept
{
return !q.empty();
})
@ -159,7 +159,7 @@ ircd::ctx::queue<T, A>::pop_until(time_point&& tp)
const bool ready
{
d.wait_until(tp, [this]
d.wait_until(tp, [this]() noexcept
{
return !q.empty();
})

View file

@ -224,14 +224,16 @@ ircd::ctx::ctx::wait()
// This is currently a dummy predicate; this is where we can take the
// user's real wakeup condition (i.e from a ctx::dock) and use it with
// an internal scheduler.
const predicate &predicate{[this]
const predicate &predicate{[this]()
noexcept
{
return notes > 0;
}};
// An interrupt invokes this closure to force the alarm to return.
const interruptor &interruptor{[this]
(ctx *const &interruptor) noexcept
(ctx *const &interruptor)
noexcept
{
wake();
}};
@ -242,7 +244,8 @@ ircd::ctx::ctx::wait()
boost::system::error_code ec; continuation
{
predicate, interruptor, [this, &ec]
(auto &yield) noexcept
(auto &yield)
noexcept
{
alarm.async_wait(yield[ec]);
}
@ -436,7 +439,8 @@ void
ircd::ctx::notify(ctx &ctx,
threadsafe_t)
{
signal(ctx, [&ctx]
signal(ctx, [&ctx]()
noexcept
{
notify(ctx);
});
@ -949,29 +953,30 @@ ircd::ctx::stack::stack(const size_t &max)
//
decltype(ircd::ctx::continuation::true_predicate)
ircd::ctx::continuation::asio_predicate{[]
() -> bool
ircd::ctx::continuation::asio_predicate{[]()
noexcept -> bool
{
return false;
}};
decltype(ircd::ctx::continuation::true_predicate)
ircd::ctx::continuation::true_predicate{[]
() -> bool
ircd::ctx::continuation::true_predicate{[]()
noexcept -> bool
{
return true;
}};
decltype(ircd::ctx::continuation::false_predicate)
ircd::ctx::continuation::false_predicate{[]
() -> bool
ircd::ctx::continuation::false_predicate{[]()
noexcept -> bool
{
return false;
}};
decltype(ircd::ctx::continuation::noop_interruptor)
ircd::ctx::continuation::noop_interruptor{[]
(ctx *const &interruptor) -> void
(ctx *const &interruptor)
noexcept -> void
{
return;
}};
@ -1479,10 +1484,11 @@ try
this->working
};
const unwind avail([this]
const unwind avail{[this]()
noexcept
{
q_max.notify();
});
}};
// Execute the user's function
func();
@ -2633,6 +2639,7 @@ ircd::ctx::condition_variable::notify_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::notify(c);
});
@ -2645,6 +2652,7 @@ ircd::ctx::condition_variable::interrupt_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::interrupt(c);
});
@ -2657,6 +2665,7 @@ ircd::ctx::condition_variable::terminate_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::terminate(c);
});
@ -2668,8 +2677,8 @@ ircd::ctx::condition_variable::waiting(const ctx &a)
const noexcept
{
// for_each returns false if a was found
return !q.for_each(list::closure_bool_const{[&a]
(const ctx &b)
return !q.for_each(list::closure_bool_const{[&a](const ctx &b)
noexcept
{
// return false to break on equal
return std::addressof(a) != std::addressof(b);
@ -2707,6 +2716,7 @@ ircd::ctx::dock::notify_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::notify(c);
});
@ -2718,6 +2728,7 @@ ircd::ctx::dock::interrupt_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::interrupt(c);
});
@ -2729,6 +2740,7 @@ ircd::ctx::dock::terminate_all()
noexcept
{
q.for_each([this](ctx &c)
noexcept
{
ircd::ctx::terminate(c);
});
@ -2783,8 +2795,8 @@ ircd::ctx::dock::waiting(const ctx &a)
const noexcept
{
// for_each returns false if a was found
return !q.for_each(list::closure_bool_const{[&a]
(const ctx &b)
return !q.for_each(list::closure_bool_const{[&a](const ctx &b)
noexcept
{
// return false to break on equal
return std::addressof(a) != std::addressof(b);
@ -2954,6 +2966,7 @@ const noexcept
{
size_t i{0};
for_each([&i](const ctx &)
noexcept
{
++i;
});

View file

@ -868,6 +868,7 @@ const
bool ret{false};
for_each(key, [&ret]
(const auto &)
noexcept
{
ret = true;
return false;
@ -883,6 +884,7 @@ const
size_t ret{0};
for_each(key, [&ret]
(const auto &)
noexcept
{
++ret;
return true;
@ -969,6 +971,7 @@ const
string_view ret;
for_each(key, [&idx, &ret]
(const auto &query)
noexcept
{
if(!idx--)
{
@ -1151,7 +1154,9 @@ ircd::http::writeline(window_buffer &write,
void
ircd::http::writeline(window_buffer &write)
{
writeline(write, [](const mutable_buffer &out)
writeline(write, []
(const mutable_buffer &out)
noexcept
{
return 0;
});

View file

@ -787,7 +787,9 @@ void
ircd::json::stack::append(const char &c)
noexcept
{
append(1, [&c](const mutable_buffer &buf)
append(1, [&c]
(const mutable_buffer &buf)
noexcept
{
buf[0] = c;
return 1;
@ -800,6 +802,7 @@ noexcept
{
append(s.size(), [&s]
(const mutable_buffer &buf)
noexcept
{
assert(ircd::size(buf) >= s.size());
return ircd::copy(buf, s);

View file

@ -107,7 +107,7 @@ try
// Wait for any pending runlevel transition to complete before
// continuing with another transition.
if(ctx::current)
changed::dock.wait([]
changed::dock.wait([]() noexcept
{
return level == chadburn;
});