Go to the source code of this file.
|
struct | callable |
| Callable function. More...
|
|
struct | future |
| Future that will get the value asynchronously (similar to C++ std::future). More...
|
|
|
typedef struct callable | callable_t |
| Callable function.
|
|
typedef struct future | future_t |
| Future that will get the value asynchronously (similar to C++ std::future).
|
|
◆ async()
Create a future variable that will store the result of callable.
Create a future variable. Create runnable function that will run callable function and add it to the thread-pool.
- Parameters
-
[in,out] | pool | – pointer to the thread-pool; |
[in,out] | future | – pointer to a variable that will store the callable result; |
[in] | callable | – function that will be run by thread-pool; |
- Returns
0
, if future was created correctly and callable function has been added to thread-pool. Non-zero value, if errors occurred.
◆ await()
Wait for future to finish.
Sleep on semaphore until the future is calculated.
- Parameters
-
[in,out] | future | – pointer to a variable that will store the callable result; |
◆ map()
Create a future variable that will store the result of callable.
Create runnable function that will run callable function and add a new task to the thread-pool.
- Parameters
-
[in,out] | pool | – pointer to the thread-pool; |
[in,out] | future | – pointer to the future variable that stores the arguments to the function; |
[in,out] | from | – pointer to a variable that will store the callable result; |
[in,out] | function | – function that will be run by thread-pool; |
- Returns
0
, if future variables were mapped correctly. Non-zero value, if errors occurred.