当前位置:网站首页>Those things about the client
Those things about the client
2022-07-18 07:23:00 【Pseudo procedural ape who loves fishing】
Previous review
At the end of the last blog, we mentioned the two most important roles of client and server in the system framework , This blog , The workflow of the client will be parsed from the structure of the code , List of reference documents :
distributedschedule_samgr_lite/samgr_client/source/remote_register.c
The relevant code comments and function introduction of this file are mentioned in the previous blog :
OpenHarmony Module two samgr_client File header and source file parsing
Function introduction
Under the document , It is mainly divided into the following function modules , The functions they involve are also the functions we will analyze in depth :
SAMGR_RegisterServiceApi // Remote register service application programming interface
SAMGR_FindServiceApi // Find services Api
SAMGR_RegisterSystemCapabilityApi // Register system capabilities Api
SAMGR_QuerySystemCapabilityApi // Query system functions Api
SAMGR_GetSystemCapabilitiesApi // Get system functions Api
ClearRegistry // Clear registry
InitializeRegistry // Registry initialization
You can see from the function , Basically, every service function cannot be built without initialization , The first step of initialization is to determine whether the registry needs to be cleared , So let's start with initialization , Start analyzing the process .
Initialization operation
ClearRegistry Clear registry
This clearing operation is mainly divided into three processes :
① call VECTOR_Clear Function destroys vector objects
② call CloseLiteIpc Function off LiteIpc
③ call SAMGR_Free Function to free the free memory
Do the above , The data of the registry that originally contained the data has been cleared
InitializeRegistry Registry initialization
The initialization operation is mainly divided into two steps :① Clear registry ;② Apply for a new space to fill in new data .
The first step to clear the registry is to use the above ClearRegistry function
The second step is divided into three steps :
g_remoteRegister.mtx = MUTEX_InitValue(); // Apply for a temporary space
g_remoteRegister.clients = VECTOR_Make((VECTOR_Key)SAMGR_GetSAName, (VECTOR_Compare)SAMGR_CompareSAName);// Create or initialize vector objects .
g_remoteRegister.endpoint = SAMGR_CreateEndpoint("ipc client", NULL); // Create a terminal
Pay attention to the function of creating terminal :SAMGR_CreateEndpoint
The function of this function is to create a terminal , The specific steps are as follows :
① Apply for a temporary space (SAMGR_Malloc)
② open LiteIpc(OpenLiteIpc)
③ Create or initialize vector objects .(VECTOR_Make)
The text description seems a little convoluted , So I drew its flow chart for you to understand :
Initialization is the most basic and important operation in the client , All services must be initialized first , Otherwise, it will cause data disorder , The remaining functions will be comprehensively analyzed in the next article .
What if you want to know what happened , See the next blog .
边栏推荐
- Tensorflow image data enhancement preprocessing
- DevSecOps研发安全实践——设计篇
- PHP大量数据循环时内存耗尽问题的解决方案
- openCV入门----VS怎么安装openCV库
- vim中如何贪婪匹配
- Pass value, reference and pointer
- 汇编入门指南
- Mmdetection record of win10 installation
- The characteristics and underlying principles of synchronized, as well as the state and expansion and upgrading process of locks
- Programming exercises
猜你喜欢
随机推荐
C 语言入门(六)
flowable 自定义属性实现和属性获取小记
浅析PHP关键词替换的类(避免重复替换,保留与还原原始链接)
consul启动闪退
PHP 如何把二维数组变为 一维数组
Getting started with compilation
makefile变量赋值
客户端的那些事儿
福赛生物解读2022上半年大气环境变化,VOCs治理依然是破局关键
mysql中 decimal(10,2)格式的通过stream 方式写到 kafka 变成 stri
Processing and analysis of yolov3 training data
如何使用HHDBCS对PolarDB for PostgreSQL存储过程进行调试?
OpenHarmony模块二初分析
日志的管理
numpy获取二维数组某一行、某一列
前六章补充案例和知识点(一)
Dictionary tree (trie tree)
Win10右键新建栏目中添加新建Markdown文件(Typora.md)
In mysql, the decimal (10,2) format is written to Kafka through stream and becomes stri
如何将面向Oracle开发的应用所使用到的复杂的SQL语句,迁移至基于PolarDB for Pos









