MCPcopy Create free account
hub / github.com/beefytech/Beef / ScanThreads

Method ScanThreads

BeefRT/dbg/gc.cpp:1503–1663  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1501}
1502
1503bool BFGC::ScanThreads()
1504{
1505 BP_ZONE("BFGC::ScanThreads");
1506
1507 mUsingThreadUnlocked = true;
1508
1509 BF_FULL_MEMORY_FENCE();
1510
1511 //BP_ZONE("ScanThreads");
1512
1513 bool didWork = false;
1514
1515 mStackScanIdx++;
1516 mDoStackDeepMark = true;
1517
1518 int threadIdx = 0;
1519
1520 while (true)
1521 {
1522 ThreadInfo* thread = NULL;
1523
1524 ///
1525 {
1526 AutoCrit autoCrit(mCritSect);
1527 for (auto& kv : mPendingThreads)
1528 {
1529 MarkFromGCThread(kv.mValue->mThread);
1530 }
1531 }
1532
1533 ///
1534 {
1535 AutoCrit autoCrit(mCritSect);
1536 if (threadIdx >= mThreadList.size())
1537 break;
1538 thread = mThreadList[threadIdx++];
1539 }
1540
1541 if (thread->mExcluded)
1542 continue;
1543
1544 if (!thread->mRunning)
1545 {
1546 AutoCrit autoCrit(mCritSect);
1547 BF_ASSERT(mThreadList[threadIdx - 1] == thread);
1548 delete thread;
1549 mThreadList.RemoveAt(threadIdx - 1);
1550 continue;
1551 }
1552
1553 BP_ZONE_F("ThreadCollect %d", thread->mThreadId);
1554 //Beefy::DebugTimeGuard suspendTimeGuard(10, "ThreadSuspend");
1555
1556 DWORD result = 0;
1557
1558 //BFMark(thread);
1559 //MarkObject(thread->mThread);
1560

Callers

nothing calls this directly

Calls 6

CalcStackStartMethod · 0.80
SleepFunction · 0.50
sizeMethod · 0.45
RemoveAtMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected