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

Function list_event

components/finsh/cmd.c:357–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355
356#ifdef RT_USING_EVENT
357long list_event(void)
358{
359 rt_base_t level;
360 list_get_next_t find_arg;
361 struct rt_object_information *info;
362 rt_list_t *obj_list[LIST_FIND_OBJ_NR];
363 rt_list_t *next = (rt_list_t *)RT_NULL;
364
365 int maxlen;
366 const char *item_title = "event";
367
368 list_find_init(&find_arg, RT_Object_Class_Event, obj_list, sizeof(obj_list) / sizeof(obj_list[0]));
369 info = rt_list_entry(find_arg.list, struct rt_object_information, object_list);
370
371 maxlen = RT_NAME_MAX;
372
373 rt_kprintf("%-*.*s set suspend thread\n", maxlen, maxlen, item_title);
374 object_split(maxlen);
375 rt_kprintf(" ---------- --------------\n");
376
377 do
378 {
379 next = list_get_next(next, &find_arg);
380 {
381 int i;
382 for (i = 0; i < find_arg.nr_out; i++)
383 {
384 struct rt_object *obj;
385 struct rt_event *e;
386
387 obj = rt_list_entry(obj_list[i], struct rt_object, list);
388 level = rt_spin_lock_irqsave(&info->spinlock);
389 if ((obj->type & ~RT_Object_Class_Static) != find_arg.type)
390 {
391 rt_spin_unlock_irqrestore(&info->spinlock, level);
392 continue;
393 }
394
395 rt_spin_unlock_irqrestore(&info->spinlock, level);
396
397 e = (struct rt_event *)obj;
398 if (!rt_list_isempty(&e->parent.suspend_thread))
399 {
400 rt_kprintf("%-*.*s 0x%08x %03d:",
401 maxlen, RT_NAME_MAX,
402 e->parent.parent.name,
403 e->set,
404 rt_list_len(&e->parent.suspend_thread));
405 rt_susp_list_print(&(e->parent.suspend_thread));
406 rt_kprintf("\n");
407 }
408 else
409 {
410 rt_kprintf("%-*.*s 0x%08x 0\n",
411 maxlen, RT_NAME_MAX, e->parent.parent.name, e->set);
412 }
413 }
414 }

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