-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libc: update cond and mutex functions documentation
JIRA: RTOS-870
- Loading branch information
Showing
8 changed files
with
195 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# condCreateWithAttr | ||
|
||
## Synopsis | ||
|
||
`#include <sys/threads.h>` | ||
|
||
`int condCreateWithAttr(handle_t *h, struct condAttr *attr);` | ||
|
||
## Status | ||
|
||
Implemented | ||
|
||
## Conformance | ||
|
||
Phoenix-RTOS specific | ||
|
||
## Description | ||
|
||
The `condCreateWithAttr()` function shall initialize the condition variable referenced by `h` using attributes | ||
specified in the `attr` structure (non-`NULL`). Upon successful initialization, the state of the condition variable | ||
shall become initialized. | ||
|
||
Attempting to initialize an already initialized condition variable results in undefined behavior. | ||
|
||
Attributes structure `condAttr` is defined as follows: | ||
|
||
```c | ||
struct condAttr { | ||
int clock; | ||
}; | ||
``` | ||
|
||
The `clock` field specifies the clock to be used for the condition variable. The following values are supported: | ||
* `PH_CLOCK_RELATIVE` - `timeout` passed to `condWait()` is relative to the current time. | ||
* `PH_CLOCK_REALTIME` - `timeout` passed to `condWait()` is absolute time based on the real-time clock. | ||
* `PH_CLOCK_MONOTONIC` - `timeout` passed to `condWait()` is absolute time based on the monotonic clock. | ||
|
||
## Return value | ||
|
||
If successful, the `condCreateWithAttr()` function shall return zero; otherwise, | ||
an error number shall be returned to indicate the error. | ||
|
||
## Errors | ||
|
||
The `condCreateWithAttr()` function shall fail if: | ||
|
||
* `-ENOMEM` - Insufficient memory exists to initialize the condition variable. | ||
* `-EINVAL` - The attributes specified in `attr` are invalid. | ||
* `-EFAULT` - The address specified by `h` or `attr` is invalid. | ||
|
||
These functions shall not return an error code of `EINTR`. | ||
|
||
## Tests | ||
|
||
Tested in [test-sys](https://github.com/phoenix-rtos/phoenix-rtos-tests/tree/master/sys) | ||
|
||
## Known bugs | ||
|
||
None | ||
|
||
## See Also | ||
|
||
1. [Standard library functions](../../index.md) | ||
2. [Table of Contents](../../../../index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# mutexCreate | ||
|
||
## Synopsis | ||
|
||
`#include <sys/threads.h>` | ||
|
||
`int mutexCreate(handle_t *h);` | ||
|
||
## Status | ||
|
||
Implemented | ||
|
||
## Conformance | ||
|
||
Phoenix-RTOS specific | ||
|
||
## Description | ||
|
||
The `mutexCreate()` function shall initialize the mutex referenced by `h` using default attributes. Upon | ||
successful initialization, the state of the mutex shall become initialized. | ||
|
||
Attempting to initialize an already initialized mutex results in undefined behavior. | ||
|
||
## Return value | ||
|
||
If successful, the `mutexCreate()` function shall return zero; otherwise, | ||
an error number shall be returned to indicate the error. | ||
|
||
## Errors | ||
|
||
The `mutexCreate()` function shall fail if: | ||
|
||
* `-ENOMEM` - Insufficient memory exists to initialize the mutex. | ||
* `-EFAULT` - The address specified by `h` is invalid. | ||
|
||
These functions shall not return an error code of `EINTR`. | ||
|
||
## Tests | ||
|
||
Tested in [test-sys](https://github.com/phoenix-rtos/phoenix-rtos-tests/tree/master/sys) | ||
|
||
## Known bugs | ||
|
||
None | ||
|
||
## See Also | ||
|
||
1. [Standard library functions](../../index.md) | ||
2. [Table of Contents](../../../../index.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# mutexCreateWithAttr | ||
|
||
## Synopsis | ||
|
||
`#include <sys/threads.h>` | ||
|
||
`int mutexCreateWithAttr(handle_t *h, struct lockAttr *attr);` | ||
|
||
## Status | ||
|
||
Implemented | ||
|
||
## Conformance | ||
|
||
Phoenix-RTOS specific | ||
|
||
## Description | ||
|
||
The `mutexCreateWithAttr()` function shall initialize the mutex referenced by `h` using attributes specified by `attr` | ||
(non-`NULL`). Upon successful initialization, the state of the mutex shall become initialized. | ||
|
||
Attempting to initialize an already initialized mutex results in undefined behavior. | ||
|
||
Attributes structure `lockAttr` is defined as follows: | ||
|
||
```c | ||
struct lockAttr { | ||
int type; | ||
}; | ||
``` | ||
|
||
The `type` field specifies the type of the mutex. The following values are supported: | ||
* `PH_LOCK_NORMAL` - The mutex is a normal mutex. | ||
* `PH_LOCK_RECURSIVE` - The mutex is a recursive mutex. A recursive mutex allows the same thread to lock the mutex | ||
multiple times. | ||
* `PH_LOCK_ERRORCHECK` - The mutex is an error-checking mutex. An error-checking mutex checks for deadlock conditions | ||
and return an error if such condition is detected. | ||
|
||
## Return value | ||
|
||
If successful, the `mutexCreateWithAttr()` function shall return zero; otherwise, an error number shall be returned to | ||
indicate the error. | ||
|
||
## Errors | ||
|
||
The `mutexCreateWithAttr()` function shall fail if: | ||
|
||
* `-ENOMEM` - Insufficient memory exists to initialize the mutex. | ||
* `-EINVAL` - The attributes specified in `attr` are invalid. | ||
* `-EFAULT` - The address specified by `h` or `attr` is invalid. | ||
|
||
These functions shall not return an error code of `EINTR`. | ||
|
||
## Tests | ||
|
||
Tested in [test-sys](https://github.com/phoenix-rtos/phoenix-rtos-tests/tree/master/sys) | ||
|
||
## Known bugs | ||
|
||
None | ||
|
||
## See Also | ||
|
||
1. [Standard library functions](../../index.md) | ||
2. [Table of Contents](../../../../index.md) |