diff options
| author | Garrett D'Amore <garrett@damore.org> | 2024-12-09 22:27:55 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2024-12-09 23:03:42 -0800 |
| commit | 2ade67cf0bad8596838762d085664d87e91093ba (patch) | |
| tree | 87cddebb07ed7d8b8a8b9c61d8e813a476d87779 /src/platform/windows/win_io.c | |
| parent | 2e72f32c61e3c6227e654285890807b9ca8709cf (diff) | |
| download | nng-2ade67cf0bad8596838762d085664d87e91093ba.tar.gz nng-2ade67cf0bad8596838762d085664d87e91093ba.tar.bz2 nng-2ade67cf0bad8596838762d085664d87e91093ba.zip | |
windows ipc: significant refactor
This refactors a lot of the IPC code to hopefully address various
hangs on shutdown, etc. The problem is that named pipes are not
terrifically reliable when it comes to aborting ConnectNamedPipe.
Additionally there were some logic errors in some of our code that
left things rather brittle.
Ultimately this all needs to be replaced with UNIX domain sockets
which are superior in many ways.
Diffstat (limited to 'src/platform/windows/win_io.c')
| -rw-r--r-- | src/platform/windows/win_io.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/platform/windows/win_io.c b/src/platform/windows/win_io.c index 815f9bf3..f5556719 100644 --- a/src/platform/windows/win_io.c +++ b/src/platform/windows/win_io.c @@ -37,11 +37,10 @@ win_io_handler(void *arg) int rv; ok = GetQueuedCompletionStatus( - win_io_h, &cnt, &key, &olpd, INFINITE); + win_io_h, &cnt, &key, &olpd, 5000); if (olpd == NULL) { // Completion port closed... - NNI_ASSERT(ok == FALSE); break; } @@ -124,12 +123,16 @@ nni_win_io_sysfini(void) HANDLE h; if ((h = win_io_h) != NULL) { + // send wakeups in case closing the handle doesn't work + for (i = 0; i < win_io_nthr; i++) { + PostQueuedCompletionStatus(h, 0, 0, NULL); + } CloseHandle(h); + for (i = 0; i < win_io_nthr; i++) { + nni_thr_fini(&win_io_thrs[i]); + } win_io_h = NULL; } - for (i = 0; i < win_io_nthr; i++) { - nni_thr_fini(&win_io_thrs[i]); - } NNI_FREE_STRUCTS(win_io_thrs, win_io_nthr); } |
