代码拉取完成,页面将自动刷新
函数名称 | 说明 |
---|---|
tk_thread_create | 创建thread对象。 |
tk_thread_destroy | 销毁thread对象。 |
tk_thread_get_args | 获取线程的参数。 |
tk_thread_join | 等待线程退出。 |
tk_thread_set_name | 设置线程的名称。 |
tk_thread_set_priority | 设置线程的优先级。 |
tk_thread_set_stack_size | 设置线程的栈大小。 |
tk_thread_start | 启动线程。 |
创建thread对象。
tk_thread_t* tk_thread_create (tk_thread_entry_t entry, void* args);
参数 | 类型 | 说明 |
---|---|---|
返回值 | tk_thread_t* | thread对象。 |
entry | tk_thread_entry_t | 线程函数。 |
args | void* | 线程函数的上下文。 |
销毁thread对象。
ret_t tk_thread_destroy (tk_thread_t* thread);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
获取线程的参数。
void* tk_thread_get_args (tk_thread_t* thread);
参数 | 类型 | 说明 |
---|---|---|
返回值 | void* | 返回线程的参数。 |
thread | tk_thread_t* | thread对象。 |
等待线程退出。
ret_t tk_thread_join (tk_thread_t* thread);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
设置线程的名称。
需要在调用start之前调用本函数。
ret_t tk_thread_set_name (tk_thread_t* thread, const char* name);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
name | const char* | 名称。 |
设置线程的优先级。
部分平台支持。
ret_t tk_thread_set_priority (tk_thread_t* thread, uint32_t priority);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
priority | uint32_t | 优先级。 |
设置线程的栈大小。
需要在调用start之前调用本函数。
ret_t tk_thread_set_stack_size (tk_thread_t* thread, uint32_t stack_size);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
stack_size | uint32_t | 栈的大小。 |
启动线程。
ret_t tk_thread_start (tk_thread_t* thread);
参数 | 类型 | 说明 |
---|---|---|
返回值 | ret_t | 返回RET_OK表示成功,否则表示失败。 |
thread | tk_thread_t* | thread对象。 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。