Path: blob/master/thirdparty/embree/common/sys/thread.h
9912 views
// Copyright 2009-2021 Intel Corporation1// SPDX-License-Identifier: Apache-2.023#pragma once45#include "platform.h"6#include "mutex.h"7#include "alloc.h"8#include "vector.h"9#include <vector>1011namespace embree12{13/*! type for thread */14typedef struct opaque_thread_t* thread_t;1516/*! signature of thread start function */17typedef void (*thread_func)(void*);1819/*! creates a hardware thread running on specific logical thread */20thread_t createThread(thread_func f, void* arg, size_t stack_size = 0, ssize_t threadID = -1);2122/*! set affinity of the calling thread */23void setAffinity(ssize_t affinity);2425/*! the thread calling this function gets yielded */26void yield();2728/*! waits until the given thread has terminated */29void join(thread_t tid);3031/*! destroy handle of a thread */32void destroyThread(thread_t tid);3334/*! type for handle to thread local storage */35typedef struct opaque_tls_t* tls_t;3637/*! creates thread local storage */38tls_t createTls();3940/*! set the thread local storage pointer */41void setTls(tls_t tls, void* const ptr);4243/*! return the thread local storage pointer */44void* getTls(tls_t tls);4546/*! destroys thread local storage identifier */47void destroyTls(tls_t tls);48}495051