Introduce a portable EIGEN_SLEEP macro.

This commit is contained in:
Benoit Steiner
2016-12-09 14:52:15 -08:00
parent aafa97f4d2
commit 4deafd35b7
5 changed files with 15 additions and 20 deletions

View File

@@ -10,8 +10,8 @@
#define EIGEN_USE_THREADS
#include "main.h"
#include <unistd.h>
#include "Eigen/CXX11/ThreadPool"
#include "Eigen/CXX11/Tensor"
static void test_create_destroy_empty_pool()
{
@@ -109,7 +109,7 @@ static void test_cancel()
// Schedule a large number of closure that each sleeps for one second. This
// will keep the thread pool busy for much longer than the default test timeout.
for (int i = 0; i < 1000; ++i) {
tp.Schedule([]() { sleep(2); });
tp.Schedule([]() { EIGEN_SLEEP(2000); });
}
// Cancel the processing of all the closures that are still pending.