Path: blob/master/thirdparty/embree/common/tasking/taskschedulerppl.h
9913 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "../sys/platform.h"6#include "../sys/alloc.h"7#include "../sys/barrier.h"8#include "../sys/thread.h"9#include "../sys/mutex.h"10#include "../sys/condition.h"11#include "../sys/ref.h"1213#if !defined(__WIN32__)14#error PPL tasking system only available under windows15#endif1617#include <ppl.h>1819namespace embree20{21struct TaskScheduler22{23/*! initializes the task scheduler */24static void create(size_t numThreads, bool set_affinity, bool start_threads);2526/*! destroys the task scheduler again */27static void destroy();2829/* returns the ID of the current thread */30static __forceinline size_t threadID() {31return GetCurrentThreadId();32}3334/* returns the index (0..threadCount-1) of the current thread */35/* FIXME: threadIndex is NOT supported by PPL! */36static __forceinline size_t threadIndex() {37return 0;38}3940/* returns the total number of threads */41static __forceinline size_t threadCount() {42return GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS) + 1;43}44};45};464748