请探讨一下鸿蒙下的Server为啥都lib库,而不是进程? 原创

发布于 2022-6-28 14:17
浏览
0收藏

请探讨一下,鸿蒙下的Server为啥都是lib库,而不是进程,那他如何解决
多进程访问,多进程资源互斥的问题呢?
尽管代码中使用ipc 多进程通讯机制,但他本身就是一个so,没有进程概念,
有ipc又如何起作用呢?那他属于哪个进程呢?

举例:
请探讨一下鸿蒙下的Server为啥都lib库,而不是进程?-开源基础软件社区
ohos_shared_library(“batteryservice”) {
sources = [
“${battery_manager_path}/services/zidl/src/battery_srv_stub.cpp”,
“native/src/battery_callback.cpp”,
“native/src/battery_dump.cpp”,
“native/src/battery_service.cpp”,
“native/src/battery_service_event_handler.cpp”,
“native/src/battery_service_subscriber.cpp”,
]

configs = [
“${utils_path}:utils_config”,
“:batterysrv_private_config”,
]

public_configs = [ “:batterysrv_public_config” ]

deps = [
“${aafwk_services_path}/appmgr:libappms”,
“${battery_manager_path}/interfaces/innerkits:batterysrv_client”,
“${displaymgr_native_innerkits_path}:displaymgr”,
“//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent_manager:libhisyseventmanager”,
“//base/powermgr/battery_manager/frameworks/dialog/dialog_ui/js:dialog_js_files_etc”,
“//base/powermgr/power_manager/interfaces/innerkits:powermgr_client”,
“//base/powermgr/power_manager/utils/permission:power_permission”,
“//drivers/peripheral/battery/interfaces/hdi_service:libbattery_interface_service_1.0”,
“//foundation/arkui/ace_engine/interfaces/inner_api/ui_service_manager:ui_service_mgr”,
“//foundation/windowmanager/utils:libwmutil”,
“//utils/native/base:utils”,
]

external_deps = [
“ability_base:base”,
“ability_base:want”,
“bundle_framework:appexecfwk_base”,
“common_event_service:cesfwk_core”,
“common_event_service:cesfwk_innerkits”,
“drivers_interface_battery:libbattery_proxy_1.0”,
“eventhandler:libeventhandler”,
“hdf_core:libhdf_utils”,
“hdf_core:libhdi”,
“hicollie_native:libhicollie”,
“hisysevent_native:libhisysevent”,
“hiviewdfx_hilog_native:libhilog”,
“ipc:ipc_core”,
“multimedia_image_standard:image_native”,
“safwk:system_ability_fwk”,
“samgr_standard:samgr_proxy”,
“window_manager:libdm”,
]

part_name = “battery_manager_native”
}

猜想是C++中的static stance 语法机制?
void BatteryService::RegisterBatteryHdiCallback()
{
BATTERY_HILOGD(COMP_SVC, “register battery hdi callback”);
if (iBatteryInterface_ == nullptr) {
iBatteryInterface_ = IBatteryInterface::Get();
RETURN_IF_WITH_LOG(iBatteryInterface_ == nullptr, “failed to get battery hdi interface”);
}
sptr<IBatteryCallback> callback = new BatteryCallback();
ErrCode ret = iBatteryInterface_->Register(callback);

class BatteryService final : public SystemAbility,
public BatterySrvStub {
DECLARE_SYSTEM_ABILITY(BatteryService)

DECLARE_DELAYED_SP_SINGLETON(BatteryService);

请问哪位大神知道这其中的原委,谢谢

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
标签
已于2022-6-28 14:19:22修改
1
收藏
回复
举报
回复
添加资源
添加资源将有机会获得更多曝光,你也可以直接关联已上传资源 去关联
    相关推荐