Skip to content

Commit

Permalink
add tk_cond_var_clear
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Feb 18, 2025
1 parent 2ce2a73 commit fc5e8a5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* list_view增加水平滚动功能(感谢兆坤提供补丁)
* 完善list_view并给edit_ex增加水平滚动条(感谢兆坤提供补丁)
* 完善注释(感谢兆坤提供补丁)
* 增加函数 tk_cond_var_clear

2025/02/17
* 完善样式(感谢兆坤提供补丁)
Expand Down
10 changes: 10 additions & 0 deletions src/tkc/cond_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ ret_t tk_cond_var_awake(tk_cond_var_t* cond_var) {
return RET_OK;
}

ret_t tk_cond_var_clear(tk_cond_var_t* cond_var) {
return_value_if_fail(cond_var != NULL && cond_var->inited, RET_BAD_PARAMS);

tk_mutex_lock(cond_var->mutex);
cond_var->has_signal = FALSE;
tk_mutex_unlock(cond_var->mutex);

return RET_OK;
}

ret_t tk_cond_var_destroy(tk_cond_var_t* cond_var) {
return_value_if_fail(cond_var != NULL && cond_var->inited, RET_BAD_PARAMS);

Expand Down
8 changes: 8 additions & 0 deletions src/tkc/cond_var.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ ret_t tk_cond_var_wait(tk_cond_var_t* cond_var, uint32_t timeout);
*/
ret_t tk_cond_var_awake(tk_cond_var_t* cond_var);

/**
* @method tk_cond_var_clear
* 清除。
* @param {tk_cond_var_t*} cond_var cond_var对象。
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
*/
ret_t tk_cond_var_clear(tk_cond_var_t* cond_var);

/**
* @method tk_cond_var_destroy
* 销毁cond_var对象。
Expand Down

0 comments on commit fc5e8a5

Please sign in to comment.