• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 
16 #include "threading/sequential_impl.h"
17 
18 #include <core/namespace.h>
19 
20 CORE_BEGIN_NAMESPACE()
21 using BASE_NS::vector;
22 
23 SequentialImpl::~SequentialImpl() = default;
24 
SequentialImpl(const IThreadPool::Ptr & threads)25 SequentialImpl::SequentialImpl(const IThreadPool::Ptr& threads) : queue_(threads) {}
26 
Submit(uint64_t taskIdentifier,IThreadPool::ITask::Ptr && task)27 void SequentialImpl::Submit(uint64_t taskIdentifier, IThreadPool::ITask::Ptr&& task)
28 {
29     queue_.Submit(taskIdentifier, move(task));
30 }
31 
SubmitAfter(uint64_t afterIdentifier,uint64_t taskIdentifier,IThreadPool::ITask::Ptr && task)32 void SequentialImpl::SubmitAfter(uint64_t afterIdentifier, uint64_t taskIdentifier, IThreadPool::ITask::Ptr&& task)
33 {
34     queue_.SubmitAfter(afterIdentifier, taskIdentifier, move(task));
35 }
36 
Execute()37 void SequentialImpl::Execute()
38 {
39     queue_.Execute();
40 }
41 
Clear()42 void SequentialImpl::Clear()
43 {
44     queue_.Clear();
45 }
46 
Destroy()47 void SequentialImpl::Destroy()
48 {
49     delete this;
50 }
51 CORE_END_NAMESPACE()
52