From e6d1592492a3a379186bfb02bd0f4eda0669c0d5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 20 Aug 2019 20:50:12 +0000 Subject: Vendor import of stripped llvm trunk r366426 (just before the release_90 branch point): https://llvm.org/svn/llvm-project/llvm/trunk@366426 --- include/llvm/Support/Threading.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'include/llvm/Support/Threading.h') diff --git a/include/llvm/Support/Threading.h b/include/llvm/Support/Threading.h index ba7ece5e72ba..46d413dc487b 100644 --- a/include/llvm/Support/Threading.h +++ b/include/llvm/Support/Threading.h @@ -1,9 +1,8 @@ //===-- llvm/Support/Threading.h - Control multithreading mode --*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -33,6 +32,9 @@ // implementations like libstdc++ are known to have problems on NetBSD, // OpenBSD and PowerPC. #define LLVM_THREADING_USE_STD_CALL_ONCE 1 +#elif defined(LLVM_ON_UNIX) && \ + ((defined(__ppc__) || defined(__PPC__)) && defined(__LITTLE_ENDIAN__)) +#define LLVM_THREADING_USE_STD_CALL_ONCE 1 #else #define LLVM_THREADING_USE_STD_CALL_ONCE 0 #endif @@ -165,6 +167,19 @@ void llvm_execute_on_thread(void (*UserFn)(void *), void *UserData, /// purposes, and as with setting a thread's name no indication of whether /// the operation succeeded or failed is returned. void get_thread_name(SmallVectorImpl &Name); + + enum class ThreadPriority { + Background = 0, + Default = 1, + }; + /// If priority is Background tries to lower current threads priority such + /// that it does not affect foreground tasks significantly. Can be used for + /// long-running, latency-insensitive tasks to make sure cpu is not hogged by + /// this task. + /// If the priority is default tries to restore current threads priority to + /// default scheduling priority. + enum class SetThreadPriorityResult { FAILURE, SUCCESS }; + SetThreadPriorityResult set_thread_priority(ThreadPriority Priority); } #endif -- cgit v1.2.3