mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-12-02 03:58:33 +08:00
improve async
This commit is contained in:
parent
0dd70a9e28
commit
4af722bbb8
@ -21,6 +21,7 @@
|
||||
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/action_thread_pool.h"
|
||||
|
||||
action_thread_pool_t* action_thread_pool_create(uint16_t max_thread_nr, uint16_t min_idle_nr) {
|
||||
return action_thread_pool_create_ex(max_thread_nr, min_idle_nr, 0, TK_THREAD_PRIORITY_NORMAL);
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ ret_t async_call(async_exec_t exec, async_on_result_t on_result, void* ctx) {
|
||||
return action_thread_pool_exec(s_async_thread_pool, a);
|
||||
}
|
||||
|
||||
ret_t async_call_init(void) {
|
||||
ret_t async_call_init(uint32_t max_threads, uint32_t min_threads) {
|
||||
return_value_if_fail(s_async_thread_pool == NULL, RET_BAD_PARAMS);
|
||||
s_async_thread_pool = action_thread_pool_create(5, 1);
|
||||
s_async_thread_pool = action_thread_pool_create(max_threads, min_threads);
|
||||
return_value_if_fail(s_async_thread_pool != NULL, RET_BAD_PARAMS);
|
||||
|
||||
return RET_OK;
|
||||
|
@ -57,11 +57,13 @@ ret_t async_call(async_exec_t exec, async_on_result_t on_result, void* ctx);
|
||||
* 全局初始化。
|
||||
*
|
||||
* @annotation ["static"]
|
||||
* @param {uint32_t} max_threads 最大线程数。
|
||||
* @param {uint32_t} min_threads 最小线程数。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*
|
||||
*/
|
||||
ret_t async_call_init(void);
|
||||
ret_t async_call_init(uint32_t max_threads, uint32_t min_threads);
|
||||
|
||||
/**
|
||||
* @method async_call_deinit
|
||||
|
Loading…
Reference in New Issue
Block a user