summaryrefslogtreecommitdiffstats
path: root/src/H5ESevent.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-05-28 14:10:51 (GMT)
committerGitHub <noreply@github.com>2021-05-28 14:10:51 (GMT)
commit2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8 (patch)
tree40975e0846d101360a838d42e16f4687fed77f4a /src/H5ESevent.c
parente22687912dbc6fcf4fff57e86e2cd5d75c81f81e (diff)
downloadhdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.zip
hdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.tar.gz
hdf5-2ddf5fbd92ebdb0d59e208d88f159eec8a1ffbf8.tar.bz2
Much normalization with develop (#701)
* Brings CMake updates from develop * Brings reduction in pedantic casts from develop * Purges UFAIL from the library (#637) * Committing clang-format changes * Purges UFAIL from the library * H5HL_insert change requested in PR Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Removes gratuitous (double)x.yF casts (#632) * Committing clang-format changes * Removes gratuitous (double)x.yF casts * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Committing clang-format changes * Cleans up a const warning left over from previous constification (#633) * Committing clang-format changes * Adds consts to a few global variables * Cleans up a const warning left over from previous constification Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Formatted source * Bring over some VOL registration changes * VOL cleanup * H5VL_request_status_t substitutions * H5F.c cleanup * Minor API tweaks from develop * Moves H5G package init/teardown to H5Gint.c * H5G cleanup * H5M cleanup * H5SM cleanup * H5T cleanup * H5R cleanup * H5Lpublic.h cleanup * H5L cleanup * H5O cleanup * H5A, H5CS, and H5AC cleanup * Moved H5A init/teardown code to H5Aint.c * Moves H5D I/O functions to H5D.c * H5D cleanup * Misc minor cleanup * H5P close cleanup * H5Tpublic.h cleanup * Fixes err_compat test * H5PLpublic.h cleanup * Updates H5Ppublic.h * H5Fpublic.h updates * H5A.c cleanup * Brings over H5Aexists and related changes * Brings CMake shell testing changes from develop * Close callback changes * H5R and H5Tcommit normalization * err_compat test works now * H5O tweaks * Updates VOL registration code * Brings over H5VL_create_object * H5Tconv.c reformatting * H5T.c tweaks * Brings datatype and reference updates from develop * Brings VOL plugin loading changes from develop * Brings event sets from develop * Brings async functions over * Tools changes * Brings over many tools changes from develop * Brings VOL flags from develop * Fixes h5dump double/float tests * Updates h5repack tests * Brings h5diff test changes from develop * Last h5dump changes * Brings test changes from develop * Committing clang-format changes * Tidied h5_testing() * Brings chunk iteration code + misc from develop * Updates vds test * Enables external link parallel test * Brings updated property lists from develop * H5G changes from develop * H5MF cleanup * Brings vfd_swmr test back into CMake * Updates threadsafe test * Updates plist test * Brings recent changes from develop Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5ESevent.c')
-rw-r--r--src/H5ESevent.c197
1 files changed, 197 insertions, 0 deletions
diff --git a/src/H5ESevent.c b/src/H5ESevent.c
new file mode 100644
index 0000000..b0c3578
--- /dev/null
+++ b/src/H5ESevent.c
@@ -0,0 +1,197 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5ESevent.c
+ * Nov 7 2020
+ * Quincey Koziol
+ *
+ * Purpose: Operations on "events" for managing asynchronous
+ * operations.
+ *
+ * Please see the asynchronous I/O RFC document
+ * for a full description of how they work, etc.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5ESmodule.h" /* This source code file is part of the H5ES module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5ESpkg.h" /* Event Sets */
+#include "H5FLprivate.h" /* Free Lists */
+#include "H5MMprivate.h" /* Memory management */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Declare a static free list to manage H5ES_event_t structs */
+H5FL_DEFINE_STATIC(H5ES_event_t);
+
+/*-------------------------------------------------------------------------
+ * Function: H5ES__event_new
+ *
+ * Purpose: Allocate and initialize a new event
+ *
+ * Return: Non-NULL pointer to new event on success, NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+H5ES_event_t *
+H5ES__event_new(H5VL_t *connector, void *token)
+{
+ H5ES_event_t * ev = NULL; /* New event */
+ H5VL_object_t *request = NULL; /* Async request token VOL object */
+ H5ES_event_t * ret_value = NULL; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(connector);
+ HDassert(token);
+
+ /* Create vol object for token */
+ if (NULL == (request = H5VL_create_object(token, connector))) {
+ if (H5VL_request_free(token) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTFREE, NULL, "can't free request")
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINIT, NULL, "can't create vol object for request token")
+ } /* end if */
+
+ /* Allocate space for new event */
+ if (NULL == (ev = H5FL_CALLOC(H5ES_event_t)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, NULL, "can't allocate event object")
+
+ /* Set request for event */
+ ev->request = request;
+
+ /* Set return value */
+ ret_value = ev;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* end H5ES__event_new() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ES__event_free
+ *
+ * Purpose: Free an event
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 7, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__event_free(H5ES_event_t *ev)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(ev);
+
+ if (ev->api_name)
+ H5MM_xfree_const(ev->api_name);
+ if (ev->api_args)
+ H5MM_xfree_const(ev->api_args);
+ if (ev->app_file)
+ H5MM_xfree_const(ev->app_file);
+ if (ev->app_func)
+ H5MM_xfree_const(ev->app_func);
+ if (ev->request) {
+ /* Free the request */
+ if (H5VL_request_free(ev->request) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free request")
+
+ /* Free the VOL object for the request */
+ if (H5VL_free_object(ev->request) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "can't free VOL request object")
+ } /* end if */
+
+ H5FL_FREE(H5ES_event_t, ev);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__event_free() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ES__event_completed
+ *
+ * Purpose: Handle a completed event
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Sunday, November 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__event_completed(H5ES_event_t *ev, H5ES_event_list_t *el)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(ev);
+
+ /* Remove the event from the event list */
+ H5ES__list_remove(el, ev);
+
+ /* Free the event */
+ if (H5ES__event_free(ev) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free event")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__event_completed() */