summaryrefslogtreecommitdiffstats
path: root/src/H5ESlist.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2022-01-20 13:34:43 (GMT)
committerGitHub <noreply@github.com>2022-01-20 13:34:43 (GMT)
commitdd6ad33c75bf084f08d4e84f92ab997c704b2096 (patch)
tree0e720e8cbf79bd99d501c10d57aaf8a03ddfe4b1 /src/H5ESlist.c
parent6c184e28d80dff5ae1efb63ca28043c62f1b7670 (diff)
downloadhdf5-dd6ad33c75bf084f08d4e84f92ab997c704b2096.zip
hdf5-dd6ad33c75bf084f08d4e84f92ab997c704b2096.tar.gz
hdf5-dd6ad33c75bf084f08d4e84f92ab997c704b2096.tar.bz2
Implement H5ESget requests function to retrieve requests from an event set (#1355)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5ESlist.c')
-rw-r--r--src/H5ESlist.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/H5ESlist.c b/src/H5ESlist.c
index 3180322..61a9dd1 100644
--- a/src/H5ESlist.c
+++ b/src/H5ESlist.c
@@ -135,7 +135,10 @@ H5ES__list_count(const H5ES_event_list_t *el)
* each event.
*
* Note: Iteration is safe for deleting the current event. Modifying
- * the list in other ways is likely unsafe.
+ * the list in other ways is likely unsafe. If order is
+ * H5_ITER_INC or H5_ITER_NATIVE events are visited starting
+ * with the oldest, otherwise they are visited starting with
+ * the newest.
*
* Return: SUCCEED / FAIL
*
@@ -145,7 +148,7 @@ H5ES__list_count(const H5ES_event_list_t *el)
*-------------------------------------------------------------------------
*/
int
-H5ES__list_iterate(H5ES_event_list_t *el, H5ES_list_iter_func_t cb, void *ctx)
+H5ES__list_iterate(H5ES_event_list_t *el, H5_iter_order_t order, H5ES_list_iter_func_t cb, void *ctx)
{
H5ES_event_t *ev; /* Event in list */
int ret_value = H5_ITER_CONT; /* Return value */
@@ -157,12 +160,12 @@ H5ES__list_iterate(H5ES_event_list_t *el, H5ES_list_iter_func_t cb, void *ctx)
HDassert(cb);
/* Iterate over events in list */
- ev = el->head;
+ ev = (order == H5_ITER_DEC) ? el->tail : el->head;
while (ev) {
H5ES_event_t *tmp; /* Temporary event */
/* Get pointer to next node, so it's safe if this one is removed */
- tmp = ev->next;
+ tmp = (order == H5_ITER_DEC) ? ev->prev : ev->next;
/* Perform iterator callback */
if ((ret_value = (*cb)(ev, ctx)) != H5_ITER_CONT) {