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

Function list_mailbox

components/finsh/cmd.c:498–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496
497#ifdef RT_USING_MAILBOX
498long list_mailbox(void)
499{
500 rt_base_t level;
501 list_get_next_t find_arg;
502 struct rt_object_information *info;
503 rt_list_t *obj_list[LIST_FIND_OBJ_NR];
504 rt_list_t *next = (rt_list_t *)RT_NULL;
505
506 int maxlen;
507 const char *item_title = "mailbox";
508
509 list_find_init(&find_arg, RT_Object_Class_MailBox, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
510 info = rt_list_entry(find_arg.list, struct rt_object_information, object_list);
511
512 maxlen = RT_NAME_MAX;
513
514 rt_kprintf("%-*.*s entry size suspend thread\n", maxlen, maxlen, item_title);
515 object_split(maxlen);
516 rt_kprintf(" ---- ---- --------------\n");
517
518 do
519 {
520 next = list_get_next(next, &find_arg);
521 {
522 int i;
523 for (i = 0; i < find_arg.nr_out; i++)
524 {
525 struct rt_object *obj;
526 struct rt_mailbox *m;
527
528 obj = rt_list_entry(obj_list[i], struct rt_object, list);
529 level = rt_spin_lock_irqsave(&info->spinlock);
530 if ((obj->type & ~RT_Object_Class_Static) != find_arg.type)
531 {
532 rt_spin_unlock_irqrestore(&info->spinlock, level);
533 continue;
534 }
535
536 rt_spin_unlock_irqrestore(&info->spinlock, level);
537
538 m = (struct rt_mailbox *)obj;
539 if (!rt_list_isempty(&m->parent.suspend_thread))
540 {
541 rt_kprintf("%-*.*s %04d %04d %d:",
542 maxlen, RT_NAME_MAX,
543 m->parent.parent.name,
544 m->entry,
545 m->size,
546 rt_list_len(&m->parent.suspend_thread));
547 rt_susp_list_print(&(m->parent.suspend_thread));
548 rt_kprintf("\n");
549 }
550 else
551 {
552 rt_kprintf("%-*.*s %04d %04d %d\n",
553 maxlen, RT_NAME_MAX,
554 m->parent.parent.name,
555 m->entry,

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