10 #define EIGEN_USE_THREADS 14 #include <Eigen/CXX11/Tensor> 16 #if EIGEN_OS_WIN || EIGEN_OS_WIN64 18 void sleep(
int seconds) {
28 void WaitAndAdd(Eigen::Notification* n,
int* counter) {
30 *counter = *counter + 1;
37 ThreadPool thread_pool(1);
40 Eigen::Notification n;
41 std::function<void()> func = std::bind(&WaitAndAdd, &n, &counter);
42 thread_pool.Schedule(func);
46 VERIFY_IS_EQUAL(counter, 0);
54 VERIFY_IS_EQUAL(counter, 1);
61 ThreadPool thread_pool(1);
64 Eigen::Notification n;
65 std::function<void()> func = std::bind(&WaitAndAdd, &n, &counter);
66 thread_pool.Schedule(func);
67 thread_pool.Schedule(func);
68 thread_pool.Schedule(func);
69 thread_pool.Schedule(func);
71 VERIFY_IS_EQUAL(counter, 0);
74 VERIFY_IS_EQUAL(counter, 4);
void test_cxx11_tensor_notification()
static void test_notification_multiple()
static void test_notification_single()