diff --git a/config.gni b/config.gni new file mode 100644 index 0000000000000000000000000000000000000000..43b205bbccc859cdec5b009a565e4f14265d9d4d --- /dev/null +++ b/config.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +declare_args() { + # configuration for samgr_lite created shared task's stack size. + # 0 means using system default thread stack size, other positive values will be accepted. + config_ohos_distributedschedule_samgr_lite_shared_task_size = 2048 +} diff --git a/samgr/BUILD.gn b/samgr/BUILD.gn index 351fb6f81f070272af589151a4e6fd960c70ef4a..77abb3622ca1a7bc3146daa979c4f21017d0bcaf 100755 --- a/samgr/BUILD.gn +++ b/samgr/BUILD.gn @@ -10,8 +10,18 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + +import("../config.gni") + +defines = [] + +if (defined(config_ohos_distributedschedule_samgr_lite_shared_task_size) && + config_ohos_distributedschedule_samgr_lite_shared_task_size > 0) { + defines += [ "SHARED_TASK_STACK_SIZE=$config_ohos_distributedschedule_samgr_lite_shared_task_size" ] +} + config("external_settings_shared") { - defines = [ "LAYER_INIT_SHARED_LIB" ] + defines += [ "LAYER_INIT_SHARED_LIB" ] } config("samgr_public") { diff --git a/samgr/source/samgr_lite.c b/samgr/source/samgr_lite.c index d7491c5ac51db5782607eadb17a968f984e164b2..dd7e0c42be42315a1e809df7db94f2dfcec6f5bb 100755 --- a/samgr/source/samgr_lite.c +++ b/samgr/source/samgr_lite.c @@ -441,7 +441,8 @@ static void AddTaskPool(ServiceImpl *service, TaskConfig *cfg, const char *name) int pos = (int)cfg->priority / PROPERTY_STEP; SamgrLiteImpl *samgr = GetImplement(); if (samgr->sharedPool[pos] == NULL) { - TaskConfig shareCfg = DEFAULT_TASK_CFG(pos); + TaskConfig shareCfg = {LEVEL_HIGH, (int16) ((pos) * PROPERTY_STEP + 1), + SHARED_TASK_STACK_SIZE, 25, SHARED_TASK}; samgr->sharedPool[pos] = SAMGR_CreateFixedTaskPool(&shareCfg, name, DEFAULT_SIZE); } service->taskPool = samgr->sharedPool[pos]; diff --git a/samgr/source/samgr_lite_inner.h b/samgr/source/samgr_lite_inner.h index d4e92c8cf3c95d89d55322e006cfbbccc3fe6820..bdbb30db1d0a20ad1487e2d783dd07e9d272ceda 100755 --- a/samgr/source/samgr_lite_inner.h +++ b/samgr/source/samgr_lite_inner.h @@ -31,7 +31,6 @@ extern "C" { #define SINGLE_SIZE 1 #define MAX_POOL_NUM 8 #define PROPERTY_STEP 8 -#define DEFAULT_TASK_CFG(pos) {LEVEL_HIGH, (int16) ((pos) * PROPERTY_STEP + 1), 0x800, 25, SHARED_TASK} #define WDG_SAMGR_INIT_TIME 1000 #define WDG_SVC_REG_TIME 5000 #define WDG_SVC_BOOT_TIME 5000