#include "mercury_util_config.h"
Go to the source code of this file.
|
typedef struct hg_request_class | hg_request_class_t |
| Purpose: define a request emulation library on top of the callback model that uses progress/trigger functions. More...
|
|
typedef struct hg_request_object | hg_request_object_t |
|
typedef int(* | hg_request_progress_func_t )(unsigned int timeout, void *arg) |
| Progress callback, arg can be used to pass extra parameters required by underlying API. More...
|
|
typedef int(* | hg_request_trigger_func_t )(unsigned int timeout, unsigned int *flag, void *arg) |
| Trigger callback, arg can be used to pass extra parameters required by underlying API. More...
|
|
Purpose: define a request emulation library on top of the callback model that uses progress/trigger functions.
Definition at line 21 of file mercury_request.h.
typedef int(* hg_request_progress_func_t)(unsigned int timeout, void *arg) |
Progress callback, arg can be used to pass extra parameters required by underlying API.
- Parameters
-
timeout | [IN] timeout (in milliseconds) |
arg | [IN] pointer to data passed to callback |
- Returns
- HG_UTIL_SUCCESS if any completion has occurred / error code otherwise
Definition at line 33 of file mercury_request.h.
typedef int(* hg_request_trigger_func_t)(unsigned int timeout, unsigned int *flag, void *arg) |
Trigger callback, arg can be used to pass extra parameters required by underlying API.
- Parameters
-
timeout | [IN] timeout (in milliseconds) |
flag | [OUT] 1 if callback has been triggered, 0 otherwise |
arg | [IN] pointer to data passed to callback |
- Returns
- HG_UTIL_SUCCESS or corresponding error code
Definition at line 45 of file mercury_request.h.
Initialize the request class with the specific progress/trigger functions that will be called on hg_request_wait().
arg can be used to pass extra parameters required by underlying API.
- Parameters
-
progress | [IN] progress function |
trigger | [IN] trigger function |
arg | [IN] pointer to data passed to callback |
- Returns
- Pointer to request class or NULL in case of failure
Finalize the request class.
- Parameters
-
request_class | [IN] pointer to request class |
Create a new request from a specified request class.
The progress function explicitly makes progress and may insert the completed operation into a completion queue. The operation gets triggered after a call to the trigger function.
- Parameters
-
request_class | [IN] pointer to request class |
- Returns
- Pointer to request or NULL in case of failure
Destroy the request, freeing the resources.
- Parameters
-
request | [IN/OUT] pointer to request |
- Returns
- Non-negative on success or negative on failure
Mark the request as completed.
(most likely called by a callback triggered after a call to trigger)
- Parameters
-
request | [IN/OUT] pointer to request |
- Returns
- Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_request_wait |
( |
hg_request_object_t * |
request, |
|
|
unsigned int |
timeout, |
|
|
unsigned int * |
flag |
|
) |
| |
Wait timeout ms for the specified request to complete.
- Parameters
-
request | [IN/OUT] pointer to request |
timeout | [IN] timeout (in milliseconds) |
flag | [OUT] 1 if request has completed, 0 otherwise |
- Returns
- Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_request_waitall |
( |
int |
count, |
|
|
hg_request_object_t * |
request[], |
|
|
unsigned int |
timeout, |
|
|
unsigned int * |
flag |
|
) |
| |
Wait timeout ms for all the specified request to complete.
- Parameters
-
count | [IN] number of requests |
request | [IN/OUT] arrays of requests |
timeout | [IN] timeout (in milliseconds) |
flag | [OUT] 1 if all requests have completed, 0 otherwise |
- Returns
- Non-negative on success or negative on failure
Attach user data to a specified request.
- Parameters
-
request | [IN/OUT] pointer to request |
data | [IN] pointer to data |
- Returns
- Non-negative on success or negative on failure
Get user data from a specified request.
- Parameters
-
request | [IN/OUT] pointer to request |
- Returns
- Pointer to data or NULL if nothing was attached by user