| 725 | } |
| 726 | |
| 727 | void Shutdown() |
| 728 | { |
| 729 | OutputDebugStrF("IOCP.Shutdown Start\n"); |
| 730 | |
| 731 | // |
| 732 | { |
| 733 | AutoCrit autoCrit(mCritSect); |
| 734 | |
| 735 | if (mShuttingDown) |
| 736 | return; |
| 737 | |
| 738 | mShuttingDown = true; |
| 739 | |
| 740 | if (!IsHandleValid(mIOCompletionPort)) |
| 741 | return; |
| 742 | } |
| 743 | |
| 744 | for (int i = 0; i < (int)mWorkerThreads.size(); i++) |
| 745 | ::PostQueuedCompletionStatus(mIOCompletionPort, 0, (ULONG_PTR)1, NULL); |
| 746 | |
| 747 | for (int i = 0; i < (int)mWorkerThreads.size(); i++) |
| 748 | { |
| 749 | ::WaitForSingleObject(mWorkerThreads[i], INFINITE); |
| 750 | ::CloseHandle(mWorkerThreads[i]); |
| 751 | } |
| 752 | |
| 753 | ::CloseHandle(mIOCompletionPort); |
| 754 | mIOCompletionPort = 0; |
| 755 | |
| 756 | OutputDebugStrF("IOCP.Shutdown Done\n"); |
| 757 | } |
| 758 | |
| 759 | void AddWorkerThread() |
| 760 | { |
nothing calls this directly
no test coverage detected