• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025-2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef MOCK_FFRT_API_CPP_THREAD_H
16 #define MOCK_FFRT_API_CPP_THREAD_H
17 #include <memory>
18 #include "cpp/task.h"
19 
20 namespace ffrt {
21 class thread {
22 public:
thread()23     thread() noexcept
24     {}
25 
26     template <typename Fn, typename... Args,
27         class = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Fn>>, thread>>>
thread(const char * name,qos qos_,Fn && fn,Args &&...args)28     explicit thread(const char *name, qos qos_, Fn &&fn, Args &&...args)
29     {
30     }
31 
32     template <typename Fn, typename... Args,
33         class = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Fn>>, thread>>>
thread(qos qos_,Fn && fn,Args &&...args)34     explicit thread(qos qos_, Fn &&fn, Args &&...args)
35     {
36     }
37 
38     template <class Fn, class... Args,
39         class = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Fn>>, thread>>,
40         class = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Fn>>, char *>>,
41         class = std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Fn>>, qos>>>
thread(Fn && fn,Args &&...args)42     explicit thread(Fn &&fn, Args &&...args)
43     {
44     }
45 
46     thread(const thread &) = delete;
47     thread &operator=(const thread &) = delete;
48 
thread(thread && th)49     thread(thread &&th) noexcept
50     {}
51 
52     thread &operator=(thread &&th) noexcept
53     {
54         return *this;
55     }
56 
joinable()57     bool joinable() const noexcept
58     {
59         return true;
60     }
61 
detach()62     void detach() noexcept
63     {}
64 
join()65     void join() noexcept
66     {
67     }
68 
~thread()69     ~thread()
70     {
71     }
72 private:
73     [[maybe_unused]] std::unique_ptr<task_handle> is_joinable;
74 };
75 }  // namespace ffrt
76 #endif