SimGrid
3.7
Scalable simulation of distributed systems
|
Defines | |
#define | xbt_dynar_foreach(_dynar, _cursor, _data) |
Iterates over the whole dynar. | |
Functions | |
void | xbt_dynar_cursor_rm (xbt_dynar_t dynar, unsigned int *const cursor) |
Removes and free the entry pointed by the cursor. | |
void | xbt_dynar_cursor_unlock (xbt_dynar_t dynar) |
Unlocks a synchronized dynar when you want to break the traversal. |
Cursors are used to iterate over the structure. Never add elements to the DynArr during the traversal. To remove elements, use the xbt_dynar_cursor_rm() function.
Do not call these functions directly, but only the xbt_dynar_foreach macro.
For synchronized dynars, the dynar will be locked during the whole loop and it will get unlocked automatically if you traverse all elements. If you want to break the loop before the end, make sure to call xbt_dynar_cursor_unlock() before the break;
#define xbt_dynar_foreach | ( | _dynar, | |
_cursor, | |||
_data | |||
) |
Iterates over the whole dynar.
_dynar | what to iterate over |
_cursor | an integer used as cursor |
_data |
xbt_dynar_t dyn; unsigned int cpt; string *str; xbt_dynar_foreach (dyn,cpt,str) { printf("Seen %s\n",str); }
void xbt_dynar_cursor_rm | ( | xbt_dynar_t | dynar, |
unsigned int *const | cursor | ||
) |
Removes and free the entry pointed by the cursor.
This function can be used while traversing without problem.
void xbt_dynar_cursor_unlock | ( | xbt_dynar_t | dynar | ) |
Unlocks a synchronized dynar when you want to break the traversal.
This function must be used if you break
the xbt_dynar_foreach loop, but shouldn't be called at the end of a regular traversal reaching the end of the elements
Back to the main Simgrid Documentation page |
The version of SimGrid documented here is v3.7. Documentation of other versions can be found in their respective archive files (directory doc/html). |
Generated by ![]() |