MCPcopy Create free account
hub / github.com/ReadyTalk/avian / runFinalizeThread

Function runFinalizeThread

src/machine.cpp:5699–5736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5697}
5698
5699void runFinalizeThread(Thread* t)
5700{
5701 GcFinalizer* finalizeList = 0;
5702 PROTECT(t, finalizeList);
5703
5704 GcCleaner* cleanList = 0;
5705 PROTECT(t, cleanList);
5706
5707 while (true) {
5708 {
5709 ACQUIRE(t, t->m->stateLock);
5710
5711 while (t->m->finalizeThread and roots(t)->objectsToFinalize() == 0
5712 and roots(t)->objectsToClean() == 0) {
5713 ENTER(t, Thread::IdleState);
5714 t->m->stateLock->wait(t->systemThread, 0);
5715 }
5716
5717 if (t->m->finalizeThread == 0) {
5718 return;
5719 } else {
5720 finalizeList = roots(t)->objectsToFinalize();
5721 roots(t)->setObjectsToFinalize(t, 0);
5722
5723 cleanList = roots(t)->objectsToClean();
5724 roots(t)->setObjectsToClean(t, 0);
5725 }
5726 }
5727
5728 for (; finalizeList; finalizeList = finalizeList->queueNext()) {
5729 finalizeObject(t, finalizeList->queueTarget(), "finalize");
5730 }
5731
5732 for (; cleanList; cleanList = cleanList->queueNext()) {
5733 finalizeObject(t, cleanList, "clean");
5734 }
5735 }
5736}
5737
5738object parseUtf8(Thread* t, const char* data, unsigned length)
5739{

Callers 1

runThreadFunction · 0.85

Calls 4

rootsFunction · 0.85
finalizeObjectFunction · 0.85
queueNextMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected