text
stringlengths 0
2.2M
|
---|
}
|
case InterruptHasObject: {
|
auto object = reinterpret_cast<exception_wrapper*>(pointer);
|
delete object;
|
break;
|
}
|
case InterruptTerminal: {
|
auto handler = reinterpret_cast<InterruptHandler*>(pointer);
|
if (handler) {
|
handler->release();
|
}
|
break;
|
}
|
}
|
}
|
void CoreBase::setCallback_(
|
Callback&& callback,
|
std::shared_ptr<folly::RequestContext>&& context,
|
futures::detail::InlineContinuation allowInline) {
|
DCHECK(!hasCallback());
|
::new (&callback_) Callback(std::move(callback));
|
::new (&context_) Context(std::move(context));
|
auto state = state_.load(std::memory_order_acquire);
|
State nextState = allowInline == futures::detail::InlineContinuation::permit
|
? State::OnlyCallbackAllowInline
|
: State::OnlyCallback;
|
if (state == State::Start) {
|
if (folly::atomic_compare_exchange_strong_explicit(
|
&state_,
|
&state,
|
nextState,
|
std::memory_order_release,
|
std::memory_order_acquire)) {
|
return;
|
}
|
assume(state == State::OnlyResult || state == State::Proxy);
|
}
|
if (state == State::OnlyResult) {
|
state_.store(State::Done, std::memory_order_relaxed);
|
doCallback(Executor::KeepAlive<>{}, state);
|
return;
|
}
|
if (state == State::Proxy) {
|
return proxyCallback(state);
|
}
|
terminate_with<std::logic_error>("setCallback unexpected state");
|
}
|
void CoreBase::setResult_(Executor::KeepAlive<>&& completingKA) {
|
DCHECK(!hasResult());
|
auto state = state_.load(std::memory_order_acquire);
|
switch (state) {
|
case State::Start:
|
if (folly::atomic_compare_exchange_strong_explicit(
|
&state_,
|
&state,
|
State::OnlyResult,
|
std::memory_order_release,
|
std::memory_order_acquire)) {
|
return;
|
}
|
assume(
|
state == State::OnlyCallback ||
|
state == State::OnlyCallbackAllowInline);
|
FOLLY_FALLTHROUGH;
|
case State::OnlyCallback:
|
case State::OnlyCallbackAllowInline:
|
state_.store(State::Done, std::memory_order_relaxed);
|
doCallback(std::move(completingKA), state);
|
return;
|
case State::OnlyResult:
|
case State::Proxy:
|
case State::Done:
|
case State::Empty:
|
default:
|
terminate_with<std::logic_error>("setResult unexpected state");
|
}
|
}
|
void CoreBase::setProxy_(CoreBase* proxy) {
|
DCHECK(!hasResult());
|
proxy_ = proxy;
|
auto state = state_.load(std::memory_order_acquire);
|
switch (state) {
|
case State::Start:
|
if (folly::atomic_compare_exchange_strong_explicit(
|
&state_,
|
&state,
|
State::Proxy,
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.