xref: /aosp_15_r20/external/eigen/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2016 Benoit Steiner <[email protected]>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H
11 #define EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H
12 
13 // Try to come up with a portable way to cancel a thread
14 #if EIGEN_OS_GNULINUX
15   #define EIGEN_THREAD_CANCEL(t)                  \
16     pthread_cancel(t.native_handle());
17   #define EIGEN_SUPPORTS_THREAD_CANCELLATION 1
18 #else
19 #define EIGEN_THREAD_CANCEL(t)
20 #endif
21 
22 
23 #endif  // EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H
24