proxygen
twoway_execute_2.cpp File Reference
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
#include <futures.h>
#include <atomic>
#include <functional>
#include <memory>
#include <thread>
#include <utility>
#include <folly/experimental/pushmi/examples/pool.h>
#include <folly/experimental/pushmi/o/transform.h>

Go to the source code of this file.

Namespaces

 p1054
 
 p1055
 

Functions

template<class T , class Executor >
std::pair< std::experimental::standard_promise< T >, std::experimental::standard_future< T, std::decay_t< Executor > > > p1054::make_promise_contract (const Executor &e)
 
template<class Executor , class Function >
std::experimental::standard_future< std::result_of_t< std::decay_t< Function >)>, std::decay_t< Executor > > p1054::twoway_execute (Executor &&e, Function &&f)
 
template<class Executor , class Function >
auto p1055::twoway_execute (Executor &&e, Function &&f)
 
int main ()
 

Function Documentation

int main ( void  )

Definition at line 75 of file twoway_execute_2.cpp.

References max, p1054::twoway_execute(), and p1055::twoway_execute().

75  {
76  mi::pool p{std::max(1u, std::thread::hardware_concurrency())};
77 
78  std::experimental::static_thread_pool sp{
79  std::max(1u, std::thread::hardware_concurrency())};
80 
81  p1054::twoway_execute(sp.executor(), []() { return 42; }).get();
82 
83  p1055::twoway_execute(p.executor(), []() { return 42; }) | op::get<int>;
84 
85  sp.stop();
86  sp.wait();
87  p.stop();
88  p.wait();
89 
90  std::cout << "OK" << std::endl;
91 }
auto twoway_execute(Executor &&e, Function &&f)
LogLevel max
Definition: LogLevel.cpp:31
std::experimental::standard_future< std::result_of_t< std::decay_t< Function >)>, std::decay_t< Executor > > twoway_execute(Executor &&e, Function &&f)