2018-12-20 17:33:31 +08:00
|
|
|
|
## tk\_mutex\_t
|
|
|
|
|
### 概述
|
2019-11-15 11:33:43 +08:00
|
|
|
|
互斥锁。
|
2019-01-15 14:34:05 +08:00
|
|
|
|
----------------------------------
|
2018-12-20 17:33:31 +08:00
|
|
|
|
### 函数
|
|
|
|
|
<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> | 加锁。 |
|
2020-05-24 19:28:22 +08:00
|
|
|
|
| <a href="#tk_mutex_t_tk_mutex_try_lock">tk\_mutex\_try\_lock</a> | 尝试加锁。 |
|
2018-12-21 12:11:40 +08:00
|
|
|
|
| <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
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-11-15 11:33:43 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_create">创建mutex。
|
2019-10-16 09:02:32 +08:00
|
|
|
|
|
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
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-11-15 11:33:43 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_destroy">销毁mutex对象。
|
2019-10-16 09:02:32 +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
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-11-15 11:33:43 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_lock">加锁。
|
2019-10-16 09:02:32 +08:00
|
|
|
|
|
2018-12-21 11:39:05 +08:00
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_mutex_lock (tk_mutex_t* mutex);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 参数说明:
|
|
|
|
|
|
2020-05-24 19:28:22 +08:00
|
|
|
|
| 参数 | 类型 | 说明 |
|
|
|
|
|
| -------- | ----- | --------- |
|
|
|
|
|
| 返回值 | ret\_t | 返回RET\_OK表示成功,否则表示失败。 |
|
|
|
|
|
| mutex | tk\_mutex\_t* | mutex对象。 |
|
|
|
|
|
#### tk\_mutex\_try\_lock 函数
|
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
|
|
* 函数功能:
|
|
|
|
|
|
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_try_lock">尝试加锁。
|
|
|
|
|
|
|
|
|
|
* 函数原型:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
ret_t tk_mutex_try_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
|
|
|
|
* 函数功能:
|
|
|
|
|
|
2019-11-15 11:33:43 +08:00
|
|
|
|
> <p id="tk_mutex_t_tk_mutex_unlock">解锁。
|
2019-10-16 09:02:32 +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对象。 |
|