void _run_in_event_loop( const lambda::function<Future<T>()>& f, const Owned<Promise<T>>& promise) { // Don't bother running the function if the future has been discarded. if (promise->future().hasDiscard()) { promise->discard(); } else { promise->set(f()); } }
Future<bool> RegistrarProcess::_apply(Owned<Operation> operation) { CHECK_SOME(variable); operations.push_back(operation); Future<bool> future = operation->future(); if (!updating) { update(); } return future; }
Future<bool> RegistrarProcess::_apply(Owned<Operation> operation) { if (error.isSome()) { return Failure(error.get()); } CHECK_SOME(variable); operations.push_back(operation); Future<bool> future = operation->future(); if (!updating) { update(); } return future; }