Get thread sleep_for test passing in C++03
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238273 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2cd0a2e4e7
commit
970d9f7768
@ -17,14 +17,17 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <cstring>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
void sig_action(int) {}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
int ec;
|
int ec;
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
action.sa_handler = [](int) {};
|
action.sa_handler = &sig_action;
|
||||||
sigemptyset(&action.sa_mask);
|
sigemptyset(&action.sa_mask);
|
||||||
action.sa_flags = 0;
|
action.sa_flags = 0;
|
||||||
|
|
||||||
@ -32,7 +35,7 @@ int main()
|
|||||||
assert(!ec);
|
assert(!ec);
|
||||||
|
|
||||||
struct itimerval it;
|
struct itimerval it;
|
||||||
it.it_interval = { 0 };
|
std::memset(&it, 0, sizeof(itimerval));
|
||||||
it.it_value.tv_sec = 0;
|
it.it_value.tv_sec = 0;
|
||||||
it.it_value.tv_usec = 250000;
|
it.it_value.tv_usec = 250000;
|
||||||
// This will result in a SIGALRM getting fired resulting in the nanosleep
|
// This will result in a SIGALRM getting fired resulting in the nanosleep
|
||||||
|
Loading…
x
Reference in New Issue
Block a user