|
|
|||
Warning, file /include/Geant4/PTL/VTask.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // 0002 // MIT License 0003 // Copyright (c) 2020 Jonathan R. Madsen 0004 // Permission is hereby granted, free of charge, to any person obtaining a copy 0005 // of this software and associated documentation files (the "Software"), to deal 0006 // in the Software without restriction, including without limitation the rights 0007 // to use, copy, modify, merge, publish, distribute, sublicense, and 0008 // copies of the Software, and to permit persons to whom the Software is 0009 // furnished to do so, subject to the following conditions: 0010 // The above copyright notice and this permission notice shall be included in 0011 // all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 0012 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 0013 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 0014 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 0015 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 0016 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 0017 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0018 // 0019 // Tasking class header file 0020 // 0021 // Class Description: 0022 // 0023 // This file creates an abstract base class for the thread-pool tasking 0024 // system 0025 // 0026 // --------------------------------------------------------------- 0027 // Author: Jonathan Madsen (Feb 13th 2018) 0028 // --------------------------------------------------------------- 0029 0030 #pragma once 0031 0032 #include <cstddef> 0033 #include <cstdint> 0034 #include <functional> 0035 #include <thread> 0036 0037 namespace PTL 0038 { 0039 //======================================================================================// 0040 0041 /// \brief VTask is the abstract class stored in thread_pool 0042 class VTask 0043 { 0044 public: 0045 using tid_type = std::thread::id; 0046 using size_type = size_t; 0047 using void_func_t = std::function<void()>; 0048 0049 public: 0050 VTask(bool _is_native, intmax_t _depth) 0051 : m_is_native{ _is_native } 0052 , m_depth{ _depth } 0053 {} 0054 0055 VTask() = default; 0056 virtual ~VTask() = default; 0057 0058 VTask(const VTask&) = delete; 0059 VTask& operator=(const VTask&) = delete; 0060 0061 VTask(VTask&&) = default; 0062 VTask& operator=(VTask&&) = default; 0063 0064 public: 0065 // execution operator 0066 virtual void operator()() = 0; 0067 0068 public: 0069 bool is_native_task() const { return m_is_native; } 0070 intmax_t depth() const { return m_depth; } 0071 0072 protected: 0073 bool m_is_native = false; 0074 intmax_t m_depth = 0; 0075 void_func_t m_func = []() {}; 0076 }; 0077 0078 //======================================================================================// 0079 0080 } // namespace PTL
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|