MESH Utility Functions.
More...
#include <glib.h>
#include <mesh.h>
#include <string.h>
Go to the source code of this file.
Functions |
| GSList * | mesh_get_live_threads (mesh_scheduler *execution_scheduler) |
| | Examines the bound_threads list of the provided mesh_scheduler and extracts all non-testbench threads whose mesh_thread.finished flag is set to false. Note that this flag is not set until the next time the thread is scheduled AFTER the final consume call of the user function. This occurs an arbitrary time after the thread has completed the consume call; the user thread should use a mesh_consume_str_no_sched as its final consume call to ensure an accurate completion time.
|
| mesh_fifo * | mesh_fifo_init (gint size) |
| | Initializes a model of a FIFO that is thread safe and can be used to exchange data between multiple communicating processes. Data can be moved to and from the FIFO using the mesh_fifo_insert() and mesh_fifo_remove() calls.
|
| mesh_fifo * | mesh_fifo_insert (mesh_fifo *fifo, void *data) |
| | Attempts to insert a data value into the FIFO. In case the FIFO is full, this function will block, waiting until an element is removed from the FIFO.
|
| mesh_fifo * | mesh_fifo_remove (mesh_fifo *fifo, void **data) |
| | Attempts to remove data from the FIFO. In case the FIFO is empty, this function will block, waiting until an element is added to the FIFO.
|
| int | mesh_fifo_num_elements (mesh_fifo *fifo) |
| | Returns the number of elements currently in the FIFO.
|
Detailed Description
MESH Utility Functions.
Function Documentation
| mesh_fifo* mesh_fifo_init |
( |
gint |
capacity |
) |
|
Initializes a model of a FIFO that is thread safe and can be used to exchange data between multiple communicating processes. Data can be moved to and from the FIFO using the mesh_fifo_insert() and mesh_fifo_remove() calls.
- Parameters:
-
| size | Number of elements the FIFO can support |
- Returns:
- Pointer of type mesh_fifo pointing to the newly created FIFO.
- See also:
- mesh_fifo_insert(), mesh_fifo_remove()
| mesh_fifo* mesh_fifo_insert |
( |
mesh_fifo * |
fifo, |
|
|
void * |
data | |
|
) |
| | |
Attempts to insert a data value into the FIFO. In case the FIFO is full, this function will block, waiting until an element is removed from the FIFO.
- Parameters:
-
| fifo | Existing FIFO into which a new piece of data is to be inserted. |
| data | Data to insert. precond mesh_fifo_init() must be run to create a FIFO. |
- Returns:
- Pointer to the modified FIFO
- See also:
- mesh_fifo_init()
| int mesh_fifo_num_elements |
( |
mesh_fifo * |
fifo |
) |
|
Returns the number of elements currently in the FIFO.
- Parameters:
-
- Returns:
- Integer with the number of elements in a FIFO
- See also:
- mesh_fifo_init()
| mesh_fifo* mesh_fifo_remove |
( |
mesh_fifo * |
fifo, |
|
|
void ** |
data | |
|
) |
| | |
Attempts to remove data from the FIFO. In case the FIFO is empty, this function will block, waiting until an element is added to the FIFO.
- Parameters:
-
| fifo | Existing FIFO from which data is to be removed. |
| data | Extracted data. precond mesh_fifo_init() must be run to create a FIFO. |
- Returns:
- Pointer to the modified FIFO
- See also:
- mesh_fifo_init()
| GSList* mesh_get_live_threads |
( |
mesh_scheduler * |
execution_scheduler |
) |
|
Examines the bound_threads list of the provided mesh_scheduler and extracts all non-testbench threads whose mesh_thread.finished flag is set to false. Note that this flag is not set until the next time the thread is scheduled AFTER the final consume call of the user function. This occurs an arbitrary time after the thread has completed the consume call; the user thread should use a mesh_consume_str_no_sched as its final consume call to ensure an accurate completion time.
- Parameters:
-
| execution_scheduler | A pointer to a mesh_scheduler |
- Returns:
- A glib linked list of all non-testbench threads controlled by the provided scheduler that have not finished