1 /* Copyright 2017-2021 PaGMO development team
2 
3 This file is part of the PaGMO library.
4 
5 The PaGMO library is free software; you can redistribute it and/or modify
6 it under the terms of either:
7 
8   * the GNU Lesser General Public License as published by the Free
9     Software Foundation; either version 3 of the License, or (at your
10     option) any later version.
11 
12 or
13 
14   * the GNU General Public License as published by the Free Software
15     Foundation; either version 3 of the License, or (at your option) any
16     later version.
17 
18 or both in parallel, as here.
19 
20 The PaGMO library is distributed in the hope that it will be useful, but
21 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23 for more details.
24 
25 You should have received copies of the GNU General Public License and the
26 GNU Lesser General Public License along with the PaGMO library.  If not,
27 see https://www.gnu.org/licenses/. */
28 
29 #ifndef PAGMO_DETAIL_GTE_GETTER_HPP
30 #define PAGMO_DETAIL_GTE_GETTER_HPP
31 
32 #include <functional>
33 
34 #include <boost/any.hpp>
35 
36 #include <pagmo/detail/visibility.hpp>
37 
38 namespace pagmo
39 {
40 
41 namespace detail
42 {
43 
44 // NOTE: in some cases, we need to call into Python
45 // from a thread created within C++ (e.g., the island thread).
46 // This function will return a RAII-style object that
47 // can be used to ensure that we can safely call into Python
48 // from the external thread. When working in C++, this
49 // functor will return an empty object with no side
50 // effects.
51 PAGMO_DLL_PUBLIC extern std::function<boost::any()> gte_getter;
52 
53 } // namespace detail
54 
55 } // namespace pagmo
56 
57 #endif
58