MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dlmodule_exec_custom

Function dlmodule_exec_custom

components/libc/posix/libdl/dlmodule.c:743–780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741}
742
743struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, int cmd_size, struct rt_dlmodule_ops* ops)
744{
745 struct rt_dlmodule *module = RT_NULL;
746
747 module = dlmodule_load_custom(pgname, ops);
748 if (module)
749 {
750 if (module->entry_addr)
751 {
752 /* exec this module */
753 rt_thread_t tid;
754
755 module->cmd_line = rt_strdup(cmd);
756
757 /* check stack size and priority */
758 if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1;
759 if (module->stack_size < 2048 || module->stack_size > (1024 * 32)) module->stack_size = 2048;
760
761 tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module,
762 module->stack_size, module->priority, 10);
763 if (tid)
764 {
765 tid->parent.module_id= module;
766 module->main_thread = tid;
767
768 rt_thread_startup(tid);
769 }
770 else
771 {
772 /* destory dl module */
773 dlmodule_destroy(module);
774 module = RT_NULL;
775 }
776 }
777 }
778
779 return module;
780}
781#endif
782
783/**

Callers

nothing calls this directly

Calls 5

dlmodule_load_customFunction · 0.85
rt_strdupFunction · 0.85
rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
dlmodule_destroyFunction · 0.85

Tested by

no test coverage detected