/home/runner/work/HiCR/HiCR/include/hicr/backends/pthreads/executionUnit.hpp Source File

HiCR: /home/runner/work/HiCR/HiCR/include/hicr/backends/pthreads/executionUnit.hpp Source File
HiCR
executionUnit.hpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 Huawei Technologies Co., Ltd.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
24#pragma once
25
26#include <hicr/core/definitions.hpp>
28#include <utility>
29#include <functional>
30
31namespace HiCR::backend::pthreads
32{
33
38{
39 public:
40
44 using pthreadFc_t = std::function<void(void *)>;
45
52 : HiCR::ExecutionUnit(),
53 _fc(std::move(fc)){};
54 ExecutionUnit() = delete;
55
59 ~ExecutionUnit() override = default;
60
61 [[nodiscard]] __INLINE__ std::string getType() const override { return "C++ Function"; }
62
68 [[nodiscard]] __INLINE__ pthreadFc_t &getFunction() { return _fc; }
69
70 private:
71
75 pthreadFc_t _fc;
76};
77
78} // namespace HiCR::backend::pthreads
std::function< void(void *)> pthreadFc_t
Definition computeManager.hpp:39
Definition executionUnit.hpp:37
Definition executionUnit.hpp:38
__INLINE__ std::string getType() const override
Definition executionUnit.hpp:61
std::function< void(void *)> pthreadFc_t
Definition executionUnit.hpp:44
ExecutionUnit(pthreadFc_t fc)
Definition executionUnit.hpp:51
__INLINE__ pthreadFc_t & getFunction()
Definition executionUnit.hpp:68
Provides a base definition for a HiCR Execution Unit class.