Skip to content

Commit 8bbfdc7

Browse files
committed
MSFT:18075741 Fail fast if the concurrent threads are not shutdown when Recycler is deleted.
1 parent e8e9baa commit 8bbfdc7

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

lib/Common/Memory/Recycler.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ class JavascriptThreadService;
3131
struct RecyclerMemoryData;
3232
#endif
3333

34-
#if DBG
3534
class ThreadContext;
36-
#endif
3735

3836
namespace Memory
3937
{
@@ -535,9 +533,7 @@ struct CollectionParam
535533
#if ENABLE_CONCURRENT_GC
536534
class RecyclerParallelThread
537535
{
538-
#if DBG
539536
friend class ThreadContext;
540-
#endif
541537

542538
public:
543539
typedef void (Recycler::* WorkFunc)();
@@ -1805,9 +1801,8 @@ class Recycler
18051801
friend class HeapInfo;
18061802
friend class HeapInfoManager;
18071803
friend class LargeHeapBucket;
1808-
#if DBG
18091804
friend class ThreadContext;
1810-
#endif
1805+
18111806
template <typename TBlockType>
18121807
friend class HeapBucketT;
18131808
template <typename TBlockType>

lib/Runtime/Base/ThreadContext.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,9 @@ ThreadContext::~ThreadContext()
527527
Assert(this->debugManager == nullptr);
528528
#endif
529529

530-
#if DBG && ENABLE_CONCURRENT_GC && defined(_WIN32)
531-
AssertMsg(recycler->concurrentThread == NULL, "Recycler background thread should have been shutdown before destroying Recycler.");
532-
AssertMsg((recycler->parallelThread1.concurrentThread == NULL) && (recycler->parallelThread2.concurrentThread == NULL), "Recycler parallelThread(s) should have been shutdown before destroying Recycler.");
530+
#if ENABLE_CONCURRENT_GC && defined(_WIN32)
531+
AssertOrFailFastMsg(recycler->concurrentThread == NULL, "Recycler background thread should have been shutdown before destroying Recycler.");
532+
AssertOrFailFastMsg((recycler->parallelThread1.concurrentThread == NULL) && (recycler->parallelThread2.concurrentThread == NULL), "Recycler parallelThread(s) should have been shutdown before destroying Recycler.");
533533
#endif
534534

535535
HeapDelete(recycler);

0 commit comments

Comments
 (0)