From e366f774a76d3607ad41dc0992e787ce38df980d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 31 Jan 2017 08:08:24 +0100 Subject: score: Add _Thread_queue_Object_name Add the special thread queue name _Thread_queue_Object_name to mark thread queues embedded in an object with identifier. Using the special thread state STATES_THREAD_QUEUE_WITH_IDENTIFIER is not reliable for this purpose since the thread wait information and thread state are protected by different SMP locks in separate critical sections. Remove STATES_THREAD_QUEUE_WITH_IDENTIFIER. Add and use _Thread_queue_Object_initialize(). Update #2858. --- cpukit/libmisc/monitor/mon-task.c | 34 +++++++++++++++++----------------- cpukit/libmisc/monitor/monitor.h | 3 +-- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'cpukit/libmisc/monitor') diff --git a/cpukit/libmisc/monitor/mon-task.c b/cpukit/libmisc/monitor/mon-task.c index 5e948c13a7..d2bc16b3ea 100644 --- a/cpukit/libmisc/monitor/mon-task.c +++ b/cpukit/libmisc/monitor/mon-task.c @@ -20,15 +20,25 @@ rtems_monitor_task_wait_info( Thread_Control *rtems_thread ) { - Thread_queue_Context queue_context; + Thread_queue_Context queue_context; + const Thread_queue_Queue *queue; _Thread_queue_Context_initialize( &queue_context ); _Thread_Wait_acquire( rtems_thread, &queue_context ); - canonical_task->state = rtems_thread->current_state; - canonical_task->wait_id = _Thread_Wait_get_id( rtems_thread ); - canonical_task->wait_queue = rtems_thread->Wait.queue; - canonical_task->wait_operations = rtems_thread->Wait.operations; + queue = rtems_thread->Wait.queue; + + if ( queue != NULL ) { + _Thread_queue_Queue_get_name_and_id( + queue, + canonical_task->wait_name, + sizeof(canonical_task->wait_name), + &canonical_task->wait_id + ); + } else { + canonical_task->wait_id = 0; + canonical_task->wait_name[0] = '\0'; + } _Thread_Wait_release( rtems_thread, &queue_context ); } @@ -55,6 +65,7 @@ rtems_monitor_task_canonical( rtems_monitor_task_wait_info( canonical_task, rtems_thread ); + canonical_task->state = rtems_thread->current_state; canonical_task->entry = rtems_thread->Start.Entry; canonical_task->stack = rtems_thread->Start.Initial_stack.area; canonical_task->stack_size = rtems_thread->Start.Initial_stack.size; @@ -117,18 +128,7 @@ rtems_monitor_task_dump( length += rtems_monitor_pad(53, length); length += rtems_monitor_dump_id(monitor_task->wait_id); length += rtems_monitor_pad(62, length); - length += rtems_monitor_dump_addr(monitor_task->wait_queue); - if (monitor_task->wait_operations == &_Thread_queue_Operations_default) { - length += fprintf(stdout, " [DFLT]"); - } else if (monitor_task->wait_operations == &_Thread_queue_Operations_FIFO) { - length += fprintf(stdout, " [FIFO]"); - } else if (monitor_task->wait_operations == &_Thread_queue_Operations_priority) { - length += fprintf(stdout, " [PRIO]"); - } else if (monitor_task->wait_operations == &_Thread_queue_Operations_priority_inherit) { - length += fprintf(stdout, " [PINH]"); - } else { - length += fprintf(stdout, " [?]"); - } + length += fprintf(stdout, "%s", monitor_task->wait_name); fprintf(stdout,"\n"); } diff --git a/cpukit/libmisc/monitor/monitor.h b/cpukit/libmisc/monitor/monitor.h index a1113649b0..8d37622529 100644 --- a/cpukit/libmisc/monitor/monitor.h +++ b/cpukit/libmisc/monitor/monitor.h @@ -106,8 +106,7 @@ typedef struct { rtems_mode modes; rtems_attribute attributes; rtems_id wait_id; - const void *wait_queue; - const void *wait_operations; + char wait_name[17]; uint32_t ticks; } rtems_monitor_task_t; -- cgit v1.2.3