• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2024 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 <atomic>
17 #include "libpandabase/os/time.h"
18 #include "plugins/ets/runtime/types/ets_primitives.h"
19 
20 namespace ark::ets::intrinsics::taskpool {
21 
22 static std::atomic<EtsLong> g_taskId = 1;
23 static std::atomic<EtsLong> g_taskGroupId = 1;
24 static std::atomic<EtsLong> g_seqRunnerId = 1;
25 
GenerateTaskId()26 extern "C" EtsLong GenerateTaskId()
27 {
28     return g_taskId++;
29 }
30 
GenerateGroupId()31 extern "C" EtsLong GenerateGroupId()
32 {
33     return g_taskGroupId++;
34 }
35 
GenerateSeqRunnerId()36 extern "C" EtsLong GenerateSeqRunnerId()
37 {
38     return g_seqRunnerId++;
39 }
40 
41 }  // namespace ark::ets::intrinsics::taskpool
42