[dlmodule] Add priority and stack size option for dlmodule.
This commit is contained in:
parent
f89b8ed250
commit
75c8515f1a
|
@ -174,16 +174,21 @@ __exit:
|
||||||
|
|
||||||
struct rt_dlmodule *dlmodule_create(void)
|
struct rt_dlmodule *dlmodule_create(void)
|
||||||
{
|
{
|
||||||
struct rt_dlmodule *ret = RT_NULL;
|
struct rt_dlmodule *module = RT_NULL;
|
||||||
|
|
||||||
ret = (struct rt_dlmodule*) rt_object_allocate(RT_Object_Class_Module, "module");
|
module = (struct rt_dlmodule*) rt_object_allocate(RT_Object_Class_Module, "module");
|
||||||
if (ret)
|
if (module)
|
||||||
{
|
{
|
||||||
ret->stat = RT_DLMODULE_STAT_INIT;
|
module->stat = RT_DLMODULE_STAT_INIT;
|
||||||
rt_list_init(&(ret->object_list));
|
|
||||||
|
/* set initial priority and stack size */
|
||||||
|
module->priority = RT_THREAD_PRIORITY_MAX - 1;
|
||||||
|
module->stack_size = 2048;
|
||||||
|
|
||||||
|
rt_list_init(&(module->object_list));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
|
void dlmodule_destroy_subthread(struct rt_dlmodule *module, rt_thread_t thread)
|
||||||
|
@ -519,8 +524,13 @@ struct rt_dlmodule* dlmodule_exec(const char* pgname, const char* cmd, int cmd_s
|
||||||
rt_thread_t tid;
|
rt_thread_t tid;
|
||||||
|
|
||||||
module->cmd_line = rt_strdup(cmd);
|
module->cmd_line = rt_strdup(cmd);
|
||||||
|
|
||||||
|
/* check stack size and priority */
|
||||||
|
if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1;
|
||||||
|
if (module->stack_size < 2048 || module->stack_size > (1024 * 32)) module->stack_size = 2048;
|
||||||
|
|
||||||
tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module,
|
tid = rt_thread_create(module->parent.name, _dlmodule_thread_entry, (void*)module,
|
||||||
2048, RT_THREAD_PRIORITY_MAX - 1, 10);
|
module->stack_size, module->priority, 10);
|
||||||
if (tid)
|
if (tid)
|
||||||
{
|
{
|
||||||
tid->module_id = module;
|
tid->module_id = module;
|
||||||
|
|
|
@ -33,8 +33,11 @@ struct rt_dlmodule
|
||||||
rt_uint8_t stat; /* status of module */
|
rt_uint8_t stat; /* status of module */
|
||||||
|
|
||||||
/* main thread of this module */
|
/* main thread of this module */
|
||||||
|
rt_uint16_t priority;
|
||||||
|
rt_uint32_t stack_size;
|
||||||
struct rt_thread *main_thread;
|
struct rt_thread *main_thread;
|
||||||
int ret_code; /* the return code */
|
/* the return code */
|
||||||
|
int ret_code;
|
||||||
|
|
||||||
/* VMA base address for the first LOAD segment */
|
/* VMA base address for the first LOAD segment */
|
||||||
rt_uint32_t vstart_addr;
|
rt_uint32_t vstart_addr;
|
||||||
|
|
Loading…
Reference in New Issue