2018-12-20 17:33:31 +08:00
|
|
|
|
## tk\_mutex\_t
|
|
|
|
|
### 概述
|
|
|
|
|
互斥锁。
|
|
|
|
|
|
|
|
|
|
### 函数
|
|
|
|
|
<p id="tk_mutex_t_methods">
|
|
|
|
|
|
|
|
|
|
| 函数名称 | 说明 |
|
|
|
|
|
| -------- | ------------ |
|
2018-12-21 12:11:40 +08:00
|
|
|
|
| <a href="#tk_mutex_t_tk_mutex_create">tk\_mutex\_create</a> | 创建mutex。 |
|
|
|
|
|
| <a href="#tk_mutex_t_tk_mutex_destroy">tk\_mutex\_destroy</a> | 销毁mutex对象。 |
|
|
|
|
|
| <a href="#tk_mutex_t_tk_mutex_lock">tk\_mutex\_lock</a> | 加锁。 |
|
|
|
|
|
| <a href="#tk_mutex_t_tk_mutex_unlock">tk\_mutex\_unlock</a> | 解锁。 |
|
2018-12-20 17:33:31 +08:00
|
|
|
|
#### tk\_mutex\_create 函数
|
2018-12-21 18:29:29 +08:00
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_create"> 创建mutex。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
tk_mutex_t* tk_mutex_create ();
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | tk\_mutex\_t* | mutex对象。 |
|
2018-12-21 18:29:29 +08:00
|
|
|
|
#### tk\_mutex\_destroy 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2018-12-21 18:29:29 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_destroy"> 销毁mutex对象。
|
2018-12-20 17:33:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_mutex_destroy (tk_mutex_t* mutex);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| mutex | tk\_mutex\_t* | mutex对象。 |
|
2018-12-21 18:29:29 +08:00
|
|
|
|
#### tk\_mutex\_lock 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2018-12-21 18:29:29 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_lock"> 加锁。
|
2018-12-20 17:33:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_mutex_lock (tk_mutex_t* mutex);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| mutex | tk\_mutex\_t* | mutex对象。 |
|
2018-12-21 18:29:29 +08:00
|
|
|
|
#### tk\_mutex\_unlock 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2018-12-21 18:29:29 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_unlock"> 解锁。
|
2018-12-20 17:33:31 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_mutex_unlock (tk_mutex_t* mutex);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2018-12-20 17:33:31 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| mutex | tk\_mutex\_t* | mutex对象。 |
|