@@ -5059,20 +5059,25 @@ Recycler::EnableConcurrent(JsUtil::ThreadService *threadService, bool startAllTh
50595059
50605060 if (startConcurrentThread)
50615061 {
5062- HANDLE concurrentThread = (HANDLE)PlatformAgnostic::Thread::Create (Recycler::ConcurrentThreadStackSize, &Recycler::StaticThreadProc, this , PlatformAgnostic::Thread::ThreadInitStackSizeParamIsAReservation);
5063- if (concurrentThread != nullptr )
5062+ auto concurrentThread = PlatformAgnostic::Thread::Create (Recycler::ConcurrentThreadStackSize,
5063+ &Recycler::StaticThreadProc, this ,
5064+ PlatformAgnostic::Thread::ThreadInitStackSizeParamIsAReservation,
5065+ _u (" Chakra Background Recycler" ));
5066+
5067+ if (concurrentThread != PlatformAgnostic::Thread::InvalidHandle)
50645068 {
5069+ HANDLE concurrentThreadWin32Handle = reinterpret_cast <HANDLE>(concurrentThread);
50655070 // Wait for recycler thread to initialize
5066- HANDLE handle[2 ] = { this ->concurrentWorkDoneEvent , concurrentThread };
5071+ HANDLE handle[2 ] = { this ->concurrentWorkDoneEvent , concurrentThreadWin32Handle };
50675072 DWORD ret = WaitForMultipleObjectsEx (2 , handle, FALSE , INFINITE, FALSE );
50685073 if (ret == WAIT_OBJECT_0)
50695074 {
50705075 this ->threadService = threadService;
5071- this ->concurrentThread = concurrentThread ;
5076+ this ->concurrentThread = concurrentThreadWin32Handle ;
50725077 return true ;
50735078 }
50745079
5075- CloseHandle (concurrentThread );
5080+ CloseHandle (concurrentThreadWin32Handle );
50765081 }
50775082 }
50785083
@@ -6702,7 +6707,14 @@ RecyclerParallelThread::EnableConcurrent(bool waitForThread)
67026707 return false ;
67036708 }
67046709
6705- this ->concurrentThread = (HANDLE)PlatformAgnostic::Thread::Create (Recycler::ConcurrentThreadStackSize, &RecyclerParallelThread::StaticThreadProc, this , PlatformAgnostic::Thread::ThreadInitStackSizeParamIsAReservation);
6710+ auto threadHandle = PlatformAgnostic::Thread::Create (Recycler::ConcurrentThreadStackSize,
6711+ &RecyclerParallelThread::StaticThreadProc, this ,
6712+ PlatformAgnostic::Thread::ThreadInitStackSizeParamIsAReservation, _u (" Chakra Recycler Parallel Thread" ));
6713+
6714+ if (threadHandle != PlatformAgnostic::Thread::InvalidHandle)
6715+ {
6716+ this ->concurrentThread = reinterpret_cast <HANDLE>(threadHandle);
6717+ }
67066718
67076719 if (this ->concurrentThread != nullptr && waitForThread)
67086720 {
0 commit comments