proxygen
simple.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #pragma once
17 #include <folly/futures/Future.h>
18 #include <folly/futures/Promise.h>
19 #include <cstdint>
20 
21 namespace folly {
22 namespace python {
23 namespace test {
24 
27  auto f = p.getFuture();
28  p.setWith([val] {
29  if (val == 0) {
30  throw std::invalid_argument("0 is not allowed");
31  }
32  return val * 5;
33  });
34  return f;
35 }
36 
38  return [val]() {
39  if (val == 0) {
40  throw std::invalid_argument("0 is not allowed");
41  }
42  return val * 5;
43  };
44 }
45 
46 } // namespace test
47 } // namespace python
48 } // namespace folly
folly::Function< uint64_t()> getValueX5Fibers(uint64_t val)
Definition: simple.h:37
auto f
void setWith(F &&func)
Definition: Promise-inl.h:137
double val
Definition: String.cpp:273
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
Future< T > getFuture()
Definition: Promise-inl.h:97
folly::Future< uint64_t > future_getValueX5(uint64_t val)
Definition: simple.h:25