runing with ledger interface
This commit is contained in:
@@ -215,7 +215,7 @@ std::string get_parent_directory() {
|
||||
init_loggers();
|
||||
|
||||
//读取模型,下载模板文件
|
||||
parse_model_cfg_web();
|
||||
//parse_model_cfg_web();
|
||||
|
||||
//解析模板文件
|
||||
//Set_xml_nodeinfo();
|
||||
@@ -518,16 +518,35 @@ void Front::mqproducerThread()
|
||||
|
||||
extern thread_info_t thread_info[THREAD_CONNECTIONS];
|
||||
|
||||
void cleanup_args(ThreadArgs* args) {
|
||||
for (int i = 0; i < args->argc; ++i) {
|
||||
free(args->argv[i]); // strdup 分配的
|
||||
}
|
||||
delete[] args->argv;
|
||||
delete args;
|
||||
}
|
||||
|
||||
void* cloudfrontthread(void* arg) {
|
||||
///////////////////////////////////////
|
||||
ThreadArgs* args = static_cast<ThreadArgs*>(arg);
|
||||
int argc = args->argc;
|
||||
char **argv = args->argv;
|
||||
|
||||
printf("argc = %d, argv[0] = %s\n", argc, argv[0]);
|
||||
printf("[cloudfrontthread] argc = %d\n", argc);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
printf(" argv[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
|
||||
//添加线程处理
|
||||
int index = *(int*)argv[0];
|
||||
// 动态解析线程 index
|
||||
int index = 0;
|
||||
if (argc > 0 && argv[0]) {
|
||||
try {
|
||||
index = std::stoi(argv[0]);
|
||||
} catch (...) {
|
||||
std::cerr << "[cloudfrontthread] Failed to parse index from argv[0]: " << argv[0] << "\n";
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// 更新线程状态为运行中
|
||||
pthread_mutex_lock(&thread_info[index].lock);
|
||||
@@ -539,11 +558,12 @@ void* cloudfrontthread(void* arg) {
|
||||
// 解析命令行参数
|
||||
if(!parse_param(argc,argv)){
|
||||
std::cerr << "process param error,exit" << std::endl;
|
||||
cleanup_args(args);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// 线程使用完后清理参数
|
||||
delete args;
|
||||
cleanup_args(args);
|
||||
|
||||
//路径获取
|
||||
FRONT_PATH = get_parent_directory();
|
||||
|
||||
Reference in New Issue
Block a user