summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2020-12-01 19:20:05 (GMT)
committerGitHub <noreply@github.com>2020-12-01 19:20:05 (GMT)
commit3e61010340b7b545f434e3b39dbb56337f8803b5 (patch)
treedb16a6276a41cfa9d6f8c7be0d74f2b02dff038d /src/H5S.c
parentadf7b1d4cf788f25a52619f5d1c957ac5a7c345c (diff)
downloadhdf5-3e61010340b7b545f434e3b39dbb56337f8803b5.zip
hdf5-3e61010340b7b545f434e3b39dbb56337f8803b5.tar.gz
hdf5-3e61010340b7b545f434e3b39dbb56337f8803b5.tar.bz2
Expand ID dec_ref and close callbacks to allow for asynchronous close operations (#135)
* Expand ID dec_ref and close callbacks to allow for asynchronous close operations. * Fix typo * Rename token -> request, remove programmer name * H5E_ATOM to H5E_ID
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c48
1 files changed, 40 insertions, 8 deletions
diff --git a/src/H5S.c b/src/H5S.c
index a9a0119..a03b58a 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -44,6 +44,7 @@
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5S__close_cb(void *space, void **request);
static htri_t H5S__is_simple(const H5S_t *sdim);
/*****************************/
@@ -81,18 +82,18 @@ H5FL_ARR_DEFINE(hsize_t, H5S_MAX_RANK);
/* Dataspace ID class */
static const H5I_class_t H5I_DATASPACE_CLS[1] = {{
- H5I_DATASPACE, /* ID class value */
- 0, /* Class flags */
- 2, /* # of reserved IDs for class */
- (H5I_free_t)H5S_close /* Callback routine for closing objects of this class */
+ H5I_DATASPACE, /* ID class value */
+ 0, /* Class flags */
+ 2, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__close_cb /* Callback routine for closing objects of this class */
}};
/* Dataspace selection iterator ID class */
static const H5I_class_t H5I_SPACE_SEL_ITER_CLS[1] = {{
- H5I_SPACE_SEL_ITER, /* ID class value */
- 0, /* Class flags */
- 0, /* # of reserved IDs for class */
- (H5I_free_t)H5S_sel_iter_close /* Callback routine for closing objects of this class */
+ H5I_SPACE_SEL_ITER, /* ID class value */
+ 0, /* Class flags */
+ 0, /* # of reserved IDs for class */
+ (H5I_free_t)H5S__sel_iter_close_cb /* Callback routine for closing objects of this class */
}};
/* Flag indicating "top" of interface has been initialized */
@@ -222,6 +223,37 @@ H5S_term_package(void)
FUNC_LEAVE_NOAPI(n)
} /* end H5S_term_package() */
+/*-------------------------------------------------------------------------
+ * Function: H5S__close_cb
+ *
+ * Purpose: Called when the ref count reaches zero on a dataspace's ID
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, April 8, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5S__close_cb(void *_space, void H5_ATTR_UNUSED **request)
+{
+ H5S_t *space = (H5S_t *)_space; /* The dataspace to close */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(space);
+
+ /* Close the dataspace object */
+ if (H5S_close(space) < 0)
+ HGOTO_ERROR(H5E_DATASPACE, H5E_CLOSEERROR, FAIL, "unable to close dataspace");
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5S__close_cb() */
+
/*--------------------------------------------------------------------------
NAME
H5S_get_validiated_dataspace