MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_object_get_length

Function rt_object_get_length

src/object.c:271–289  ·  view source on GitHub ↗

* @brief This function will return the length of object list in object container. * * @param type is the type of object, which can be * RT_Object_Class_Thread/Semaphore/Mutex... etc * * @return the length of object list */

Source from the content-addressed store, hash-verified

269 * @return the length of object list
270 */
271int rt_object_get_length(enum rt_object_class_type type)
272{
273 int count = 0;
274 rt_base_t level;
275 struct rt_list_node *node = RT_NULL;
276 struct rt_object_information *information = RT_NULL;
277
278 information = rt_object_get_information((enum rt_object_class_type)type);
279 if (information == RT_NULL) return 0;
280
281 level = rt_spin_lock_irqsave(&(information->spinlock));
282 rt_list_for_each(node, &(information->object_list))
283 {
284 count ++;
285 }
286 rt_spin_unlock_irqrestore(&(information->spinlock), level);
287
288 return count;
289}
290RTM_EXPORT(rt_object_get_length);
291
292/**

Callers 6

list_processFunction · 0.85
list_sessionFunction · 0.85
sys_sysinfoFunction · 0.85
list_processgroupFunction · 0.85
dfs_devfs_updateFunction · 0.85

Calls 3

rt_spin_lock_irqsaveFunction · 0.70

Tested by 1