diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2022-01-20 13:34:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-20 13:34:43 (GMT) |
commit | dd6ad33c75bf084f08d4e84f92ab997c704b2096 (patch) | |
tree | 0e720e8cbf79bd99d501c10d57aaf8a03ddfe4b1 /src/H5ES.c | |
parent | 6c184e28d80dff5ae1efb63ca28043c62f1b7670 (diff) | |
download | hdf5-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/H5ES.c')
-rw-r--r-- | src/H5ES.c | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -236,6 +236,61 @@ done: } /* end H5ESget_op_counter() */ /*------------------------------------------------------------------------- + * Function: H5ESget_requests + * + * Purpose: Retrieve the requests in an event set. Up to *count + * requests are stored in the provided requests array, and + * the connector ids corresponding to these requests are + * stored in the provided connector_ids array. Either or + * both of these arrays may be NULL, in which case this + * information is not returned. If these arrays are + * non-NULL, they must be large enough to contain *count + * entries. On exit, *count is set to the total number of + * events in the event set. + * + * Events are returned in the order they were added to the + * event set. If order is H5_ITER_INC or H5_ITER_NATIVE, + * events will be returned starting from the oldest. If order + * is H5_ITER_DEC, events will be returned starting with the + * newest/most recent. + * + * Return: SUCCEED / FAIL + * + * Programmer: Neil Fortner + * Tuesday, November 23, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5ESget_requests(hid_t es_id, H5_iter_order_t order, hid_t *connector_ids, void **requests, size_t array_len, + size_t *count /*out*/) +{ + H5ES_t *es; /* Event set */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "iIo*i**xx", es_id, order, connector_ids, requests, count); + + /* Check arguments */ + if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + + /* Call internal routine */ + if (array_len > 0 && (requests || connector_ids)) + if (H5ES__get_requests(es, order, connector_ids, requests, array_len) < 0) + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get requests") + + /* Retrieve the count, if non-NULL */ + if (count) + *count = H5ES__list_count(&es->active); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5ESget_requests() */ + +/*------------------------------------------------------------------------- * Function: H5ESwait * * Purpose: Wait (with timeout) for operations in event set to complete |