Implemented Request queue garbage collection.

This commit is contained in:
Tristan B. Kildaire 2020-06-23 11:18:41 +02:00
parent 02ca3d9bb5
commit 594914d33b
1 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,20 @@ public final class GarbageCollector : Thread
manager.lockQueue();
/* TODO: Add clean up here */
/* Construct a new list */
Request[] newList;
/* Only add to this list unfulfilled requests */
foreach(Request request; *requestQueueVariable)
{
if(!request.isFulfilled())
{
newList ~= request;
}
}
/* Update the queue to the new queue */
*requestQueueVariable = newList;
/* Unlock the queue */
manager.unlockQueue();