#include "llvm/Support/Threading.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/thread.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/Triple.h"
#include "gtest/gtest.h"
#include <atomic>
#include <condition_variable>
usingnamespacellvm;
namespace {
static bool isThreadingSupportedArchAndOS() { … }
TEST(Threading, PhysicalConcurrency) { … }
TEST(Threading, NumPhysicalCoresSupported) { … }
TEST(Threading, NumPhysicalCoresUnsupported) { … }
#if LLVM_ENABLE_THREADS
class Notification { … };
TEST(Threading, RunOnThreadSyncAsync) { … }
TEST(Threading, RunOnThreadSync) { … }
#if defined(__APPLE__)
TEST(Threading, AppleStackSize) {
llvm::thread Thread([] {
volatile unsigned char Var[8 * 1024 * 1024 - 10240];
Var[0] = 0xff;
ASSERT_EQ(Var[0], 0xff);
});
Thread.join();
}
#endif
#endif
}