summaryrefslogtreecommitdiffstats
path: root/src/H5ESpkg.h
blob: e4088bf688b387f584f80670f5d5f6f93eb3c319 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * 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.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

/*
 * Programmer:  Quincey Koziol
 *              Wednesday, April 8, 2020
 *
 * Purpose:	This file contains declarations which are visible only within
 *		the H5ES package.  Source files outside the H5ES package should
 *		include H5ESprivate.h instead.
 */
#if !(defined H5ES_FRIEND || defined H5ES_MODULE)
#error "Do not include this file outside the H5ES package!"
#endif

#ifndef _H5ESpkg_H
#define _H5ESpkg_H

/* Get package's private header */
#include "H5ESprivate.h"

/* Other private headers needed by this file */

/**************************/
/* Package Private Macros */
/**************************/

/****************************/
/* Package Private Typedefs */
/****************************/

/* Typedef for event nodes */
typedef struct H5ES_event_t {
    H5VL_object_t *      request;     /* Request token for event */
    struct H5ES_event_t *prev, *next; /* Previous and next event nodes */

    /* Useful info for debugging and error reporting */
    const char *api_name; /* Name of API routine for event */
    const char *api_args; /* Arguments to API routine */
    const char *app_file; /* Name of source file from application */
    const char *app_func; /* Name of source function from application */
    unsigned    app_line; /* Line # of source file from application */
    uint64_t    ev_count; /* This event is the n'th operation in the event set */
    uint64_t    ev_time;  /* Timestamp for this event (in ms from UNIX epoch) */
} H5ES_event_t;

/* Typedef for lists of event set operations */
typedef struct H5ES_event_list_t {
    size_t        count;       /* # of events in list */
    H5ES_event_t *head, *tail; /* Head & tail of events in list */
} H5ES_event_list_t;

/* Typedef for event set objects */
struct H5ES_t {
    uint64_t op_counter; /* Count of operations inserted into this set */

    /* Active events */
    H5ES_event_list_t active; /* List of active events in set */

    /* Failed events */
    hbool_t           err_occurred; /* Flag for error from an operation */
    H5ES_event_list_t failed;       /* List of failed events in set */
};

/* Event list iterator callback function */
typedef int (*H5ES_list_iter_func_t)(H5ES_event_t *ev, void *ctx);

/*****************************/
/* Package Private Variables */
/*****************************/

/******************************/
/* Package Private Prototypes */
/******************************/
H5_DLL H5ES_t *H5ES__create(void);
H5_DLL herr_t  H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_failed);
H5_DLL herr_t  H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[],
                                  size_t *num_cleared);
H5_DLL herr_t  H5ES__close(H5ES_t *es);

/* Event list operations */
H5_DLL void   H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev);
H5_DLL size_t H5ES__list_count(const H5ES_event_list_t *el);
H5_DLL int    H5ES__list_iterate(H5ES_event_list_t *el, H5ES_list_iter_func_t cb, void *ctx);
H5_DLL void   H5ES__list_remove(H5ES_event_list_t *el, const H5ES_event_t *ev);

/* Event operations */
H5_DLL H5ES_event_t *H5ES__event_new(H5VL_t *connector, void *token);
H5_DLL herr_t        H5ES__event_free(H5ES_event_t *ev);
H5_DLL herr_t        H5ES__event_completed(H5ES_event_t *ev, H5ES_event_list_t *el);

#endif /* _H5ESpkg_H */