main.cpp 626 Bytes
Newer Older
1
// Headers are available because we added the pls target
2 3
const long NUM_THREADS = 8;
const long MEMORY_PER_THREAD = 2u << 12u;
4

5
#include "pls/pls.h"
6

7
pls::static_scheduler_memory<NUM_THREADS, MEMORY_PER_THREAD> memory;
8

9 10
int main() {
  pls::scheduler scheduler{&memory, NUM_THREADS};
11

12 13 14 15 16
  scheduler.perform_work([]() {
    auto lambda = []() {
      // Do work
    };
    using lambda_task = pls::lambda_task_by_value<decltype(lambda)>;
17

18 19
    pls::scheduler::spawn_child<lambda_task>(lambda);
    pls::scheduler::spawn_child<lambda_task>(lambda);
20 21 22

    pls::scheduler::wait_for_all();
  });
23 24 25

  scheduler.terminate();
  return 0;
26
}