| 1 |
/* |
| 2 |
* Copyright (C) by Argonne National Laboratory |
| 3 |
* See COPYRIGHT in top-level directory |
| 4 |
*/ |
| 5 |
|
| 6 |
#include "tcp_impl.h" |
| 7 |
|
| 8 |
int MPID_nem_tcp_finalize(void) |
| 9 |
{ |
| 10 |
int mpi_errno = MPI_SUCCESS; |
| 11 |
int ret; |
| 12 |
#ifdef HAVE_ERROR_CHECKING |
| 13 |
char strerrbuf[MPIR_STRERROR_BUF_SIZE]; |
| 14 |
#endif |
| 15 |
|
| 16 |
MPIR_FUNC_ENTER; |
| 17 |
|
| 18 |
mpi_errno = MPID_nem_tcp_send_finalize(); |
| 19 |
MPIR_ERR_CHECK(mpi_errno); |
| 20 |
mpi_errno = MPID_nem_tcp_sm_finalize(); |
| 21 |
MPIR_ERR_CHECK(mpi_errno); |
| 22 |
|
| 23 |
if (MPID_nem_tcp_g_lstn_sc.fd) { |
| 24 |
CHECK_EINTR(ret, close(MPID_nem_tcp_g_lstn_sc.fd)); |
| 25 |
MPIR_ERR_CHKANDJUMP2(ret == -1, mpi_errno, MPI_ERR_OTHER, "**closesocket", |
| 26 |
"**closesocket %s %d", errno, |
| 27 |
MPIR_Strerror(errno, strerrbuf, MPIR_STRERROR_BUF_SIZE)); |
| 28 |
} |
| 29 |
|
| 30 |
fn_exit: |
| 31 |
MPIR_FUNC_EXIT; |
| 32 |
return mpi_errno; |
| 33 |
fn_fail: |
| 34 |
goto fn_exit; |
| 35 |
} |