diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/socket.c | 1 | ||||
| -rw-r--r-- | src/platform/windows/win_thread.c | 10 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index 711cd57a..9471e56e 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -403,6 +403,7 @@ void nni_sock_sys_fini(void) { nni_idhash_fini(nni_sock_hash); + nni_sock_hash = NULL; nni_mtx_fini(&nni_sock_lk); } diff --git a/src/platform/windows/win_thread.c b/src/platform/windows/win_thread.c index f78bfd9a..c01ec782 100644 --- a/src/platform/windows/win_thread.c +++ b/src/platform/windows/win_thread.c @@ -141,20 +141,21 @@ nni_plat_thr_fini(nni_plat_thr *thr) } } +static LONG plat_inited = 0; + int nni_plat_init(int (*helper)(void)) { - static LONG inited = 0; int rv; static SRWLOCK lock = SRWLOCK_INIT; - if (inited) { + if (plat_inited) { return (0); // fast path } AcquireSRWLockExclusive(&lock); - if (!inited) { + if (!plat_inited) { if ((rv = nni_win_iocp_sysinit()) != 0) { goto out; } @@ -169,7 +170,7 @@ nni_plat_init(int (*helper)(void)) } helper(); - inited = 1; + plat_inited = 1; } out: @@ -186,6 +187,7 @@ nni_plat_fini(void) nni_win_tcp_sysfini(); nni_win_iocp_sysfini(); WSACleanup(); + plat_inited = 0; } #else |
