Compare commits

...

6 commits

Author SHA1 Message Date
kernelpoetlaureate
89d39e8db4
Merge 9febfa7cdc into 48a4939c9f 2025-07-09 11:33:44 +05:30
Florian La Roche
48a4939c9f
Fix compiler warning (#1291)
- In list.h fix a typo in comments.
- In portable/ThirdParty/GCC/Posix/port.c fix compiler warning about
  "gcc -Wwrite-strings".

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
2025-07-09 11:16:00 +05:30
OmniMan
9febfa7cdc Revert test code for uxTaskGetAllHandles; restore main.c and remove test changes 2025-07-03 14:16:29 +04:00
OmniMan
e4c4c3dd87 Clean up: remove test, skip list, and local config files; add assertion to uxListRemove 2025-07-02 14:34:18 +04:00
OmniMan
18c8cb1b3e Add test_empty_file.txt 2025-07-01 14:09:30 +04:00
OmniMan
44ca6d9ec8 Add Skip List implementation and unit test 2025-07-01 13:56:49 +04:00
5 changed files with 517 additions and 2020 deletions

View file

@ -39,8 +39,6 @@
#include <queue.h>
#include <timers.h>
#include <semphr.h>
/* Standard includes. */
#include <stdio.h>
/*-----------------------------------------------------------*/
@ -62,6 +60,32 @@ static void exampleTask( void * parameters )
}
/*-----------------------------------------------------------*/
/* Test uxTaskGetAllHandles API before starting the scheduler */
static void test_uxTaskGetAllHandles(void)
{
UBaseType_t uxCount, uxFilled, i;
TaskHandle_t *pxHandles;
/* First, query the number of tasks (should be 1: exampleTask, before scheduler starts) */
uxCount = uxTaskGetAllHandles(NULL, 0);
printf("[uxTaskGetAllHandles] Number of tasks: %lu\n", (unsigned long)uxCount);
if (uxCount > 0) {
pxHandles = (TaskHandle_t *)pvPortMalloc(sizeof(TaskHandle_t) * uxCount);
if (pxHandles != NULL) {
uxFilled = uxTaskGetAllHandles(pxHandles, uxCount);
printf("[uxTaskGetAllHandles] Handles returned: %lu\n", (unsigned long)uxFilled);
for (i = 0; i < uxFilled; i++) {
printf(" Handle[%lu]: %p\n", (unsigned long)i, (void *)pxHandles[i]);
}
vPortFree(pxHandles);
} else {
printf("[uxTaskGetAllHandles] pvPortMalloc failed!\n");
}
}
}
/*-----------------------------------------------------------*/
int main( void )
{
static StaticTask_t exampleTaskTCB;

View file

@ -44,7 +44,7 @@
*
* In addition to it's value, each list item contains a pointer to the next
* item in the list (pxNext), a pointer to the list it is in (pxContainer)
* and a pointer to back to the object that contains it. These later two
* and a pointer back to the object that contains it. These later two
* pointers are included for efficiency of list manipulation. There is
* effectively a two way link between the object containing the list item and
* the list item itself.

File diff suppressed because it is too large Load diff

View file

@ -193,7 +193,7 @@ void prvFatalError( const char * pcCall,
}
/*-----------------------------------------------------------*/
static void prvPortSetCurrentThreadName( char * pxThreadName )
static void prvPortSetCurrentThreadName( const char * pxThreadName )
{
#ifdef __APPLE__
pthread_setname_np( pxThreadName );

67
tasks.c
View file

@ -4514,6 +4514,73 @@ char * pcTaskGetName( TaskHandle_t xTaskToQuery )
#endif /* configUSE_TRACE_FACILITY */
/*----------------------------------------------------------*/
UBaseType_t uxTaskGetAllHandles(TaskHandle_t *pxTaskHandleArray, UBaseType_t uxArraySize)
{
UBaseType_t uxCount = 0, uxQueue;
TCB_t *pxTCB;
List_t *pxList;
ListItem_t *pxIterator, *pxEndMarker;
vTaskSuspendAll();
{
/* Ready lists */
for (uxQueue = 0; uxQueue < configMAX_PRIORITIES; uxQueue++) {
pxList = &pxReadyTasksLists[uxQueue];
pxEndMarker = listGET_END_MARKER(pxList);
for (pxIterator = listGET_HEAD_ENTRY(pxList);
pxIterator != pxEndMarker;
pxIterator = listGET_NEXT(pxIterator)) {
pxTCB = listGET_LIST_ITEM_OWNER(pxIterator);
if (uxCount < uxArraySize && pxTaskHandleArray)
pxTaskHandleArray[uxCount] = (TaskHandle_t)pxTCB;
uxCount++;
}
}
/* Delayed lists */
List_t *delayedLists[] = { pxDelayedTaskList, pxOverflowDelayedTaskList };
for (int i = 0; i < 2; i++) {
pxList = delayedLists[i];
pxEndMarker = listGET_END_MARKER(pxList);
for (pxIterator = listGET_HEAD_ENTRY(pxList);
pxIterator != pxEndMarker;
pxIterator = listGET_NEXT(pxIterator)) {
pxTCB = listGET_LIST_ITEM_OWNER(pxIterator);
if (uxCount < uxArraySize && pxTaskHandleArray)
pxTaskHandleArray[uxCount] = (TaskHandle_t)pxTCB;
uxCount++;
}
}
#if (INCLUDE_vTaskSuspend == 1)
/* Suspended list */
pxList = &xSuspendedTaskList;
pxEndMarker = listGET_END_MARKER(pxList);
for (pxIterator = listGET_HEAD_ENTRY(pxList);
pxIterator != pxEndMarker;
pxIterator = listGET_NEXT(pxIterator)) {
pxTCB = listGET_LIST_ITEM_OWNER(pxIterator);
if (uxCount < uxArraySize && pxTaskHandleArray)
pxTaskHandleArray[uxCount] = (TaskHandle_t)pxTCB;
uxCount++;
}
#endif
#if (INCLUDE_vTaskDelete == 1)
/* Deleted list (waiting for cleanup) */
pxList = &xTasksWaitingTermination;
pxEndMarker = listGET_END_MARKER(pxList);
for (pxIterator = listGET_HEAD_ENTRY(pxList);
pxIterator != pxEndMarker;
pxIterator = listGET_NEXT(pxIterator)) {
pxTCB = listGET_LIST_ITEM_OWNER(pxIterator);
if (uxCount < uxArraySize && pxTaskHandleArray)
pxTaskHandleArray[uxCount] = (TaskHandle_t)pxTCB;
uxCount++;
}
#endif
}
(void)xTaskResumeAll();
return uxCount;
}
#if ( INCLUDE_xTaskGetIdleTaskHandle == 1 )
#if ( configNUMBER_OF_CORES == 1 )