0.2.0-dev Download ZIP
46 lines ·1.1 KB Raw
| 1 | // Copyright 2009-2021 Intel Corporation |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "../sys/platform.h" |
| 7 | #include "../sys/alloc.h" |
| 8 | #include "../sys/barrier.h" |
| 9 | #include "../sys/thread.h" |
| 10 | #include "../sys/mutex.h" |
| 11 | #include "../sys/condition.h" |
| 12 | #include "../sys/ref.h" |
| 13 | |
| 14 | #if !defined(__WIN32__) |
| 15 | #error PPL tasking system only available under windows |
| 16 | #endif |
| 17 | |
| 18 | #include <ppl.h> |
| 19 | |
| 20 | namespace embree |
| 21 | { |
| 22 | struct TaskScheduler |
| 23 | { |
| 24 | /*! initializes the task scheduler */ |
| 25 | static void create(size_t numThreads, bool set_affinity, bool start_threads); |
| 26 | |
| 27 | /*! destroys the task scheduler again */ |
| 28 | static void destroy(); |
| 29 | |
| 30 | /* returns the ID of the current thread */ |
| 31 | static __forceinline size_t threadID() { |
| 32 | return GetCurrentThreadId(); |
| 33 | } |
| 34 | |
| 35 | /* returns the index (0..threadCount-1) of the current thread */ |
| 36 | /* FIXME: threadIndex is NOT supported by PPL! */ |
| 37 | static __forceinline size_t threadIndex() { |
| 38 | return 0; |
| 39 | } |
| 40 | |
| 41 | /* returns the total number of threads */ |
| 42 | static __forceinline size_t threadCount() { |
| 43 | return GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS) + 1; |
| 44 | } |
| 45 | }; |
| 46 | }; |