Files
llvm-project/lldb/test/expression_command/timeout/wait-a-while.cpp
T
Zachary Turner c7826524ac Get test executables compiling on Windows.
Many of the test executables use pthreads directly.  This isn't
portable on Windows, so this patch converts these test to use
C++11 threads and mutexes.  Since Windows' implementation of
std::thread classes throw and catch from header files, this patch
also disables exceptions when compiling with clang on Windows.

Reviewed by: Todd Fiala, Ed Maste

Differential Revision: http://reviews.llvm.org/D4816

llvm-svn: 215562
2014-08-13 17:44:53 +00:00

32 lines
493 B
C++

#include <stdio.h>
#include <stdint.h>
#include <chrono>
#include <thread>
int
wait_a_while (int microseconds)
{
int num_times = 0;
while (1)
{
num_times++;
std::this_thread::sleep_for(std::chrono::microseconds(microseconds));
break;
}
return num_times;
}
int
main (int argc, char **argv)
{
printf ("stop here in main.\n");
int num_times = wait_a_while (argc * 1000);
printf ("Done, took %d times.\n", num_times);
return 0;
}