mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
sync tkc
This commit is contained in:
parent
c5a6e7b705
commit
3c99555cab
@ -1,5 +1,8 @@
|
||||
# 最新动态
|
||||
2022/04/23
|
||||
* 完善 socket\_resolve 防止溢出(感谢叶冬提供补丁)
|
||||
* 完善 tk\_socket\_close 支持AWorks(感谢叶冬提供补丁)
|
||||
* 增加 async\_call\_init\_ex2(感谢叶冬提供补丁)
|
||||
* 重构time clock中anchor处理。
|
||||
* 重构gauge pointer中anchor处理。
|
||||
|
||||
|
@ -78,8 +78,12 @@ ret_t async_call(async_exec_t exec, async_on_result_t on_result, void* ctx) {
|
||||
}
|
||||
|
||||
ret_t async_call_init_ex(uint32_t max_threads, uint32_t min_threads) {
|
||||
return async_call_init_ex2(max_threads, min_threads, 0);
|
||||
}
|
||||
|
||||
ret_t async_call_init_ex2(uint32_t max_threads, uint32_t min_threads, uint32_t stack_size) {
|
||||
return_value_if_fail(s_async_thread_pool == NULL, RET_BAD_PARAMS);
|
||||
s_async_thread_pool = action_thread_pool_create(max_threads, min_threads);
|
||||
s_async_thread_pool = action_thread_pool_create_ex(max_threads, min_threads, stack_size, TK_THREAD_PRIORITY_NORMAL);
|
||||
return_value_if_fail(s_async_thread_pool != NULL, RET_BAD_PARAMS);
|
||||
|
||||
return RET_OK;
|
||||
|
@ -65,6 +65,20 @@ ret_t async_call(async_exec_t exec, async_on_result_t on_result, void* ctx);
|
||||
*/
|
||||
ret_t async_call_init_ex(uint32_t max_threads, uint32_t min_threads);
|
||||
|
||||
/**
|
||||
* @method async_call_init_ex2
|
||||
* 全局初始化。
|
||||
*
|
||||
* @annotation ["static"]
|
||||
* @param {uint32_t} max_threads 最大线程数。
|
||||
* @param {uint32_t} min_threads 最小线程数。
|
||||
* @param {uint32_t} stack_size 栈空间大小(字节)。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*
|
||||
*/
|
||||
ret_t async_call_init_ex2(uint32_t max_threads, uint32_t min_threads, uint32_t stack_size);
|
||||
|
||||
#define async_call_init() async_call_init_ex(5, 1)
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,11 @@ ret_t tk_socket_deinit() {
|
||||
}
|
||||
|
||||
ret_t tk_socket_close(int sock) {
|
||||
#ifdef AWORKS
|
||||
closesocket(sock);
|
||||
#else
|
||||
close(sock);
|
||||
#endif
|
||||
return RET_OK;
|
||||
}
|
||||
#endif /*WIN32*/
|
||||
@ -157,6 +161,8 @@ struct sockaddr* socket_resolve(const char* host, int port, struct sockaddr_in*
|
||||
memset(addr, 0x00, sizeof(*addr));
|
||||
addr->sin_family = AF_INET;
|
||||
addr->sin_port = htons(port);
|
||||
return_value_if_fail(h->h_addrtype == AF_INET, NULL);
|
||||
|
||||
memcpy(&(addr->sin_addr.s_addr), h->h_addr, h->h_length);
|
||||
|
||||
return (struct sockaddr*)addr;
|
||||
|
Loading…
Reference in New Issue
Block a user