forked from Imagelibrary/rtems
score: Add _Objects_Active_count()
This commit is contained in:
@@ -190,7 +190,8 @@ libscore_a_SOURCES += src/objectallocate.c src/objectclose.c \
|
||||
src/objectshrinkinformation.c src/objectgetnoprotection.c \
|
||||
src/objectidtoname.c src/objectgetnameasstring.c src/objectsetname.c \
|
||||
src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \
|
||||
src/objectnamespaceremove.c
|
||||
src/objectnamespaceremove.c \
|
||||
src/objectactivecount.c
|
||||
|
||||
## SCHEDULER_C_FILES
|
||||
libscore_a_SOURCES += src/scheduler.c
|
||||
|
||||
@@ -862,6 +862,17 @@ void _Objects_Close(
|
||||
Objects_Control *the_object
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Returns the count of active objects.
|
||||
*
|
||||
* @param[in] information The object information table.
|
||||
*
|
||||
* @return The count of active objects.
|
||||
*/
|
||||
Objects_Maximum _Objects_Active_count(
|
||||
const Objects_Information *information
|
||||
);
|
||||
|
||||
/*
|
||||
* Pieces of object.inl are promoted out to the user
|
||||
*/
|
||||
|
||||
29
cpukit/score/src/objectactivecount.c
Normal file
29
cpukit/score/src/objectactivecount.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
Objects_Maximum _Objects_Active_count(
|
||||
const Objects_Information *information
|
||||
)
|
||||
{
|
||||
size_t inactive = _Chain_Node_count_unprotected( &information->Inactive );
|
||||
size_t maximum = information->maximum;
|
||||
|
||||
return (Objects_Maximum) ( maximum - inactive );
|
||||
}
|
||||
Reference in New Issue
Block a user