From f0238cfb6997c4acfc2bd200de7295f3fa36968f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Mar 2019 21:09:10 +0100 Subject: don't index Eigen --- .../unsupported/test/cxx11_tensor_notification.cpp | 81 ---------------------- 1 file changed, 81 deletions(-) delete mode 100644 eigen/unsupported/test/cxx11_tensor_notification.cpp (limited to 'eigen/unsupported/test/cxx11_tensor_notification.cpp') diff --git a/eigen/unsupported/test/cxx11_tensor_notification.cpp b/eigen/unsupported/test/cxx11_tensor_notification.cpp deleted file mode 100644 index c946007..0000000 --- a/eigen/unsupported/test/cxx11_tensor_notification.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2015 Vijay Vasudevan -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#define EIGEN_USE_THREADS - -#include -#include "main.h" -#include - -#if EIGEN_OS_WIN || EIGEN_OS_WIN64 -#include -void sleep(int seconds) { - Sleep(seconds*1000); -} -#else -#include -#endif - - -namespace { - -void WaitAndAdd(Eigen::Notification* n, int* counter) { - n->Wait(); - *counter = *counter + 1; -} - -} // namespace - -static void test_notification_single() -{ - ThreadPool thread_pool(1); - - int counter = 0; - Eigen::Notification n; - std::function func = std::bind(&WaitAndAdd, &n, &counter); - thread_pool.Schedule(func); - sleep(1); - - // The thread should be waiting for the notification. - VERIFY_IS_EQUAL(counter, 0); - - // Unblock the thread - n.Notify(); - - sleep(1); - - // Verify the counter has been incremented - VERIFY_IS_EQUAL(counter, 1); -} - -// Like test_notification_single() but enqueues multiple threads to -// validate that all threads get notified by Notify(). -static void test_notification_multiple() -{ - ThreadPool thread_pool(1); - - int counter = 0; - Eigen::Notification n; - std::function func = std::bind(&WaitAndAdd, &n, &counter); - thread_pool.Schedule(func); - thread_pool.Schedule(func); - thread_pool.Schedule(func); - thread_pool.Schedule(func); - sleep(1); - VERIFY_IS_EQUAL(counter, 0); - n.Notify(); - sleep(1); - VERIFY_IS_EQUAL(counter, 4); -} - -void test_cxx11_tensor_notification() -{ - CALL_SUBTEST(test_notification_single()); - CALL_SUBTEST(test_notification_multiple()); -} -- cgit v1.2.3