Commit 74b3d019 authored by Paul's avatar Paul
Browse files

Formatting

parent 4f778e9f
......@@ -7,25 +7,21 @@ namespace migraph {
struct swallow
{
template<class... Ts>
template <class... Ts>
swallow(Ts&&...)
{}
{
}
};
struct tracer
{
tracer()
{}
tracer() {}
tracer(std::ostream& s) : os(&s)
{}
tracer(std::ostream& s) : os(&s) {}
bool enabled() const
{
return os != nullptr;
}
bool enabled() const { return os != nullptr; }
template<class... Ts>
template <class... Ts>
void operator()(const Ts&... xs) const
{
if(os != nullptr)
......@@ -35,8 +31,8 @@ struct tracer
}
}
private:
std::ostream * os = nullptr;
private:
std::ostream* os = nullptr;
};
} // namespace migraph
......
......@@ -24,15 +24,19 @@
// An improved async, that doesn't block
template <class Function>
std::future<typename std::result_of<Function()>::type> detach_async(Function&& f, bool parallel=true)
std::future<typename std::result_of<Function()>::type> detach_async(Function&& f,
bool parallel = true)
{
if(parallel){
if(parallel)
{
using result_type = typename std::result_of<Function()>::type;
std::packaged_task<result_type()> task(std::forward<Function>(f));
auto fut = task.get_future();
std::thread(std::move(task)).detach();
return std::move(fut);
} else {
}
else
{
return std::async(std::launch::deferred, std::move(f));
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment