Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Close unused diagnostic server thread handle (#27141)
Browse files Browse the repository at this point in the history
Fixes #27135
  • Loading branch information
jkotas authored Oct 11, 2019
1 parent 58b016c commit d8bbcc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/vm/diagnosticserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

IpcStream::DiagnosticsIpc *DiagnosticServer::s_pIpc = nullptr;
Volatile<bool> DiagnosticServer::s_shuttingDown(false);
HANDLE DiagnosticServer::s_hServerThread = INVALID_HANDLE_VALUE;

DWORD WINAPI DiagnosticServer::DiagnosticsServerThread(LPVOID)
{
Expand Down Expand Up @@ -147,15 +146,15 @@ bool DiagnosticServer::Initialize()
auto_trace_launch();
#endif
DWORD dwThreadId = 0;
s_hServerThread = ::CreateThread( // TODO: Is it correct to have this "lower" level call here?
HANDLE hServerThread = ::CreateThread( // TODO: Is it correct to have this "lower" level call here?
nullptr, // no security attribute
0, // default stack size
DiagnosticsServerThread, // thread proc
(LPVOID)s_pIpc, // thread parameter
0, // not suspended
&dwThreadId); // returns thread ID

if (s_hServerThread == NULL)
if (hServerThread == NULL)
{
delete s_pIpc;
s_pIpc = nullptr;
Expand All @@ -169,6 +168,8 @@ bool DiagnosticServer::Initialize()
}
else
{
::CloseHandle(hServerThread);

#ifdef FEATURE_AUTO_TRACE
auto_trace_wait();
#endif
Expand Down
1 change: 0 additions & 1 deletion src/vm/diagnosticserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class DiagnosticServer final
private:
static IpcStream::DiagnosticsIpc *s_pIpc;
static Volatile<bool> s_shuttingDown;
static HANDLE s_hServerThread;
};

#endif // FEATURE_PERFTRACING
Expand Down

0 comments on commit d8bbcc4

Please sign in to comment.