| 568 | |
| 569 | #ifdef RT_USING_MESSAGEQUEUE |
| 570 | long 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 | } |
no test coverage detected