
#ifndef PLS_INVOKE_PARALLEL_IMPL_H
#define PLS_INVOKE_PARALLEL_IMPL_H

#include "pls/internal/scheduling/scheduler.h"

namespace pls::algorithm {

template<typename Function1, typename Function2>
void invoke(Function1 &&function1, Function2 &&function2) {
  using namespace ::pls::internal::scheduling;

  scheduler::spawn(std::forward<Function1>(function1));
  scheduler::spawn(std::forward<Function2>(function2));
  scheduler::sync();
}

template<typename Function1, typename Function2, typename Function3>
void invoke(Function1 &&function1, Function2 &&function2, Function3 &&function3) {
  using namespace ::pls::internal::scheduling;

  scheduler::spawn(std::forward<Function1>(function1));
  scheduler::spawn(std::forward<Function2>(function2));
  scheduler::spawn(std::forward<Function3>(function3));
  scheduler::sync();
}

}

#endif //PLS_INVOKE_PARALLEL_IMPL_H
