brintos

brintos / llvm-project-archived public Read only

0
0
Text · 299 B · 0f043ca Raw
26 lines · cpp
1#include <sys/types.h>2#include <thread>3#include <unistd.h>4 5template <typename T>6void launcher(T func) {7  auto t1 = std::thread(func);8  auto t2 = std::thread(func);9 10  t1.join();11  t2.join();12}13 14void g() {}15 16void f() {17  fork();18  launcher<>(g);19}20 21int main() {22  launcher<>(f);23 24  return 0;25}26