Add priority & stack_size parameters for dlmodule custom
This commit is contained in:
parent
2a175faea5
commit
f38b5a9f9f
|
@ -709,6 +709,7 @@ __exit:
|
||||||
struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, int cmd_size, struct rt_dlmodule_ops* ops)
|
struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, int cmd_size, struct rt_dlmodule_ops* ops)
|
||||||
{
|
{
|
||||||
struct rt_dlmodule *module = RT_NULL;
|
struct rt_dlmodule *module = RT_NULL;
|
||||||
|
rt_uint32_t tick = 10;
|
||||||
|
|
||||||
module = dlmodule_load_custom(pgname, ops);
|
module = dlmodule_load_custom(pgname, ops);
|
||||||
if (module)
|
if (module)
|
||||||
|
@ -721,11 +722,14 @@ struct rt_dlmodule* dlmodule_exec_custom(const char* pgname, const char* cmd, in
|
||||||
module->cmd_line = rt_strdup(cmd);
|
module->cmd_line = rt_strdup(cmd);
|
||||||
|
|
||||||
/* check stack size and priority */
|
/* check stack size and priority */
|
||||||
|
if (ops->priority) module->priority = ops->priority;
|
||||||
|
if (ops->stack_size) module->stack_size = ops->stack_size;
|
||||||
|
if (ops->tick) tick = ops->tick;
|
||||||
if (module->priority > RT_THREAD_PRIORITY_MAX) module->priority = RT_THREAD_PRIORITY_MAX - 1;
|
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;
|
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,
|
||||||
module->stack_size, module->priority, 10);
|
module->stack_size, module->priority, tick);
|
||||||
if (tid)
|
if (tid)
|
||||||
{
|
{
|
||||||
tid->module_id = module;
|
tid->module_id = module;
|
||||||
|
|
|
@ -63,6 +63,10 @@ struct rt_dlmodule_ops
|
||||||
{
|
{
|
||||||
rt_uint8_t *(*load)(const char* filename); /* load dlmodule file data */
|
rt_uint8_t *(*load)(const char* filename); /* load dlmodule file data */
|
||||||
rt_err_t (*unload)(rt_uint8_t *param); /* unload dlmodule file data */
|
rt_err_t (*unload)(rt_uint8_t *param); /* unload dlmodule file data */
|
||||||
|
|
||||||
|
rt_uint16_t priority;
|
||||||
|
rt_uint32_t stack_size;
|
||||||
|
rt_uint32_t tick;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rt_dlmodule *dlmodule_create(void);
|
struct rt_dlmodule *dlmodule_create(void);
|
||||||
|
|
Loading…
Reference in New Issue