增加 Linux 常用 C API.
Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
parent
b88e2a6325
commit
39d327b46f
|
@ -0,0 +1,59 @@
|
|||
# Linux 常用 C API
|
||||
|
||||
## 1.sleep 函数
|
||||
|
||||
**头文件:**
|
||||
|
||||
```cpp
|
||||
#include <unistd.h>
|
||||
```
|
||||
|
||||
**函数原型:**
|
||||
|
||||
```cpp
|
||||
unsigned int sleep(unsigned int seconds);
|
||||
```
|
||||
|
||||
**说明:**
|
||||
|
||||
sleep() causes the calling thread to sleep either until the number of real-time seconds specified in *seconds* have elapsed or until a signal arrives which is not ignored.
|
||||
|
||||
**参数:**
|
||||
|
||||
seconds:sleep 的时间,以秒为单位。
|
||||
|
||||
**返回值:**
|
||||
|
||||
Zero if the requested time has elapsed, or the number of seconds left to sleep, if the call was interrupted by a signal handler.
|
||||
|
||||
## 2.usleep 函数
|
||||
|
||||
**头文件:**
|
||||
|
||||
```cpp
|
||||
#include <unistd.h>
|
||||
```
|
||||
|
||||
**函数原型:**
|
||||
|
||||
```cpp
|
||||
int usleep(useconds_t usec);
|
||||
```
|
||||
|
||||
**说明:**
|
||||
|
||||
The usleep() function suspends execution of the calling thread for (at least) usec microseconds. The sleep may be lengthened slightly by any system activity or by the time spent processing the call or by the granularity of system timers.
|
||||
|
||||
**参数:**
|
||||
|
||||
usec:sleep 的时间,以微秒为单位。
|
||||
|
||||
**返回值:**
|
||||
|
||||
The usleep() function returns 0 on success. On error, -1 is returned, with errno set to indicate the cause of the error.
|
||||
|
||||
## 3.Posix
|
||||
|
||||
### 3.1.pthread_create 函数
|
||||
|
||||
### 3.3.pthread_join 函数
|
Loading…
Reference in New Issue