proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
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
25
folly::Future<uint64_t>
future_getValueX5
(
uint64_t
val
) {
26
folly::Promise<uint64_t>
p;
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
37
folly::Function<uint64_t()>
getValueX5Fibers
(
uint64_t
val
) {
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::python::test::getValueX5Fibers
folly::Function< uint64_t()> getValueX5Fibers(uint64_t val)
Definition:
simple.h:37
f
auto f
Definition:
PushmiBenchmarks.cpp:515
test
folly::Promise::setWith
void setWith(F &&func)
Definition:
Promise-inl.h:137
val
double val
Definition:
String.cpp:273
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
folly::Promise
Definition:
Future-pre.h:23
Promise.h
Future.h
folly::Promise::getFuture
Future< T > getFuture()
Definition:
Promise-inl.h:97
folly::Future
Definition:
FiberManagerInternal.h:46
folly::Function
Definition:
Function.h:235
uint64_t
uint64_t
Definition:
ConstexprMathBenchmark.cpp:190
folly::python::test::future_getValueX5
folly::Future< uint64_t > future_getValueX5(uint64_t val)
Definition:
simple.h:25
proxygen
folly
folly
python
test
simple.h
Generated by
1.8.11