From 1380e4c8ec58a470fbd16120356bc5b6904b4877 Mon Sep 17 00:00:00 2001 From: Cedric Guillemet Date: Wed, 1 Apr 2020 11:51:42 +0200 Subject: [PATCH] Unix support --- CMakeLists.txt | 2 ++ .../Unix/arcana/threading/task_schedulers.h | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Source/Unix/arcana/threading/task_schedulers.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a54f4b2..218f1a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,5 +89,7 @@ else() target_include_directories(arcana INTERFACE "Source/Android") elseif(APPLE) target_include_directories(arcana INTERFACE "Source/Apple") + elseif(UNIX) + target_include_directories(arcana INTERFACE "Source/Unix") endif() endif() diff --git a/Source/Unix/arcana/threading/task_schedulers.h b/Source/Unix/arcana/threading/task_schedulers.h new file mode 100644 index 0000000..6148391 --- /dev/null +++ b/Source/Unix/arcana/threading/task_schedulers.h @@ -0,0 +1,23 @@ +// +// Copyright (C) Microsoft Corporation. All rights reserved. +// + +#pragma once + +namespace arcana +{ + // NOTE: These task schedulers are for the arcana task system. + + namespace + { + // TOOD: this is a stop gap for platforms that don't have a threadpool implementation + constexpr struct + { + template + void operator()(CallableT&& callable) const + { + std::thread([callable{ std::forward(callable) }]() { callable(); }).detach(); + } + } threadpool_scheduler{}; + } +}