MCPcopy Index your code
hub / github.com/RT-Thread/rt-thread / list_msgqueue

Function list_msgqueue

components/finsh/cmd.c:570–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568
569#ifdef RT_USING_MESSAGEQUEUE
570long list_msgqueue(void)
571{
572 rt_base_t level;
573 list_get_next_t find_arg;
574 struct rt_object_information *info;
575 rt_list_t *obj_list[LIST_FIND_OBJ_NR];
576 rt_list_t *next = (rt_list_t *)RT_NULL;
577
578 int maxlen;
579 const char *item_title = "msgqueue";
580
581 list_find_init(&find_arg, RT_Object_Class_MessageQueue, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
582 info = rt_list_entry(find_arg.list, struct rt_object_information, object_list);
583
584 maxlen = RT_NAME_MAX;
585
586 rt_kprintf("%-*.*s entry suspend thread\n", maxlen, maxlen, item_title);
587 object_split(maxlen);
588 rt_kprintf(" ---- --------------\n");
589 do
590 {
591 next = list_get_next(next, &find_arg);
592 {
593 int i;
594 for (i = 0; i < find_arg.nr_out; i++)
595 {
596 struct rt_object *obj;
597 struct rt_messagequeue *m;
598
599 obj = rt_list_entry(obj_list[i], struct rt_object, list);
600 level = rt_spin_lock_irqsave(&info->spinlock);
601 if ((obj->type & ~RT_Object_Class_Static) != find_arg.type)
602 {
603 rt_spin_unlock_irqrestore(&info->spinlock, level);
604 continue;
605 }
606
607 rt_spin_unlock_irqrestore(&info->spinlock, level);
608
609 m = (struct rt_messagequeue *)obj;
610 if (!rt_list_isempty(&m->parent.suspend_thread))
611 {
612 rt_kprintf("%-*.*s %04d %d:",
613 maxlen, RT_NAME_MAX,
614 m->parent.parent.name,
615 m->entry,
616 rt_list_len(&m->parent.suspend_thread));
617 rt_susp_list_print(&(m->parent.suspend_thread));
618 rt_kprintf("\n");
619 }
620 else
621 {
622 rt_kprintf("%-*.*s %04d %d\n",
623 maxlen, RT_NAME_MAX,
624 m->parent.parent.name,
625 m->entry,
626 rt_list_len(&m->parent.suspend_thread));
627 }

Callers 2

ifFunction · 0.85
cmd_listFunction · 0.85

Calls 9

rt_kprintfFunction · 0.85
rt_list_isemptyFunction · 0.85
rt_list_lenFunction · 0.85
rt_susp_list_printFunction · 0.85
list_find_initFunction · 0.70
object_splitFunction · 0.70
list_get_nextFunction · 0.70
rt_spin_lock_irqsaveFunction · 0.50

Tested by

no test coverage detected