From 2a42cba50c2a3c37bc5ba71203a143498bb098a4 Mon Sep 17 00:00:00 2001 From: Juri Date: Fri, 1 May 2020 00:01:27 +0200 Subject: [PATCH] remove function get_fibers_from() --- source/core/MicroBitFiber.cpp | 40 +---------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/source/core/MicroBitFiber.cpp b/source/core/MicroBitFiber.cpp index cbcc7ff3..38fc3021 100644 --- a/source/core/MicroBitFiber.cpp +++ b/source/core/MicroBitFiber.cpp @@ -67,44 +67,6 @@ static EventModel *messageBus = NULL; // Array of components which are iterated during idle thread execution. static MicroBitComponent* idleThreadComponents[MICROBIT_IDLE_COMPONENTS]; -static void get_fibers_from(Fiber ***dest, int *sum, Fiber *queue) -{ - if (queue && queue->prev) - microbit_panic(MICROBIT_HEAP_ERROR); - while (queue) { - if (*dest) - *(*dest)++ = queue; - (*sum)++; - queue = queue->next; - } -} - -/** - * Return all current fibers. - * - * @param dest If non-null, it points to an array of pointers to fibers to store results in. - * - * @return the number of fibers (potentially) stored - */ -int list_fibers(Fiber **dest) -{ - int sum = 0; - - // interrupts might move fibers between queues, but should not create new ones - __disable_irq(); - get_fibers_from(&dest, &sum, runQueue); - get_fibers_from(&dest, &sum, sleepQueue); - get_fibers_from(&dest, &sum, waitQueue); - __enable_irq(); - - // idleFiber is used to start event handlers using invoke(), - // so it may in fact have the user_data set if in FOB context - if (dest) - *dest++ = idleFiber; - sum++; - return sum; -} - /** * Utility function to add the currenty running fiber to the given queue. * @@ -1153,4 +1115,4 @@ void MicroBitLock::notifyAll() } locked = false; -} +} \ No newline at end of file