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
|
/**
* Copyright (C) 2021 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
*
* See file LICENSE for terms.
*/
#ifndef UCP_UTIL_H_
#define UCP_UTIL_H_
#include <ucp/api/ucp.h>
/**
* Close UCP endpoint.
*
* @param [in] worker Handle to the worker that the endpoint is associated
* with.
* @param [in] ep Handle to the endpoint to close.
* @param [in] flags Close UCP endpoint mode. Please see
* @a ucp_ep_close_flags_t for details.
*/
static void ep_close(ucp_worker_h ucp_worker, ucp_ep_h ep, uint64_t flags)
{
ucp_request_param_t param;
ucs_status_t status;
void *close_req;
param.op_attr_mask = UCP_OP_ATTR_FIELD_FLAGS;
param.flags = flags;
close_req = ucp_ep_close_nbx(ep, ¶m);
if (UCS_PTR_IS_PTR(close_req)) {
do {
ucp_worker_progress(ucp_worker);
status = ucp_request_check_status(close_req);
} while (status == UCS_INPROGRESS);
ucp_request_free(close_req);
} else {
status = UCS_PTR_STATUS(close_req);
}
if (status != UCS_OK) {
fprintf(stderr, "failed to close ep %p: %s\n", (void*)ep,
ucs_status_string(status));
}
}
#endif
|