Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@ -0,0 +1,20 @@
//===-- thread_inferior.cpp -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <string>
#include <cstdlib>
int main() {
const char *value = std::getenv("LLDB_TEST_MAGIC_VARIABLE");
if (!value)
return 1;
if (std::string(value) != "LLDB_TEST_MAGIC_VALUE")
return 2;
return 0;
}

View File

@ -0,0 +1,41 @@
//===-- thread_inferior.cpp -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <atomic>
#include <chrono>
#include <string>
#include <thread>
#include <vector>
int main(int argc, char* argv[]) {
int thread_count = 2;
if (argc > 1) {
thread_count = std::stoi(argv[1], nullptr, 10);
}
std::atomic<bool> delay(true);
std::vector<std::thread> threads;
for (int i = 0; i < thread_count; i++) {
threads.push_back(std::thread([&delay] {
while (delay.load())
std::this_thread::sleep_for(std::chrono::seconds(1));
}));
}
// Cause a break.
volatile char *p = NULL;
*p = 'a';
delay.store(false);
for (std::thread& t : threads) {
t.join();
}
return 0;
}