forked from Imagelibrary/rtems
score: Add STATES_THREAD_QUEUE_WITH_IDENTIFIER
Add thread state bit to identify thread queues that are embedded in an object with identifier.
This commit is contained in:
@@ -521,7 +521,7 @@ rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
|
||||
{ "Wbar", STATES_WAITING_FOR_BARRIER },
|
||||
{ "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE },
|
||||
{ "Wevnt", STATES_WAITING_FOR_EVENT },
|
||||
{ "Wisig", STATES_INTERRUPTIBLE_BY_SIGNAL },
|
||||
{ "ISIG" , STATES_INTERRUPTIBLE_BY_SIGNAL },
|
||||
{ "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT },
|
||||
{ "Wjoin", STATES_WAITING_FOR_JOIN },
|
||||
{ "Wmsg" , STATES_WAITING_FOR_MESSAGE },
|
||||
@@ -532,10 +532,8 @@ rtems_debugger_thread_state_str(rtems_debugger_thread* thread,
|
||||
{ "Wseg", STATES_WAITING_FOR_SEGMENT },
|
||||
{ "Wsem", STATES_WAITING_FOR_SEMAPHORE },
|
||||
{ "Wsig", STATES_WAITING_FOR_SIGNAL },
|
||||
{ "Wslcnd", STATES_WAITING_FOR_SYS_LOCK_CONDITION },
|
||||
{ "Wslftx", STATES_WAITING_FOR_SYS_LOCK_FUTEX },
|
||||
{ "Wslmtx", STATES_WAITING_FOR_SYS_LOCK_MUTEX },
|
||||
{ "Wslsem", STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE },
|
||||
{ "Wfutex", STATES_WAITING_FOR_FUTEX },
|
||||
{ "TQID", STATES_THREAD_QUEUE_WITH_IDENTIFIER },
|
||||
{ "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT },
|
||||
{ "Wtime", STATES_WAITING_FOR_TIME },
|
||||
{ "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP },
|
||||
|
||||
@@ -112,29 +112,31 @@ rtems_monitor_dump_priority(rtems_task_priority priority)
|
||||
return fprintf(stdout,"%3" PRId32, priority);
|
||||
}
|
||||
|
||||
#define WITH_ID(state) (STATES_THREAD_QUEUE_WITH_IDENTIFIER | state)
|
||||
|
||||
static const rtems_assoc_t rtems_monitor_state_assoc[] = {
|
||||
{ "DELAY", STATES_DELAYING, 0 },
|
||||
{ "DORM", STATES_DORMANT, 0 },
|
||||
{ "LIFE", STATES_LIFE_IS_CHANGING, 0 },
|
||||
{ "SUSP", STATES_SUSPENDED, 0 },
|
||||
{ "Wbar", STATES_WAITING_FOR_BARRIER, 0 },
|
||||
{ "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE, 0 },
|
||||
{ "Wbar", WITH_ID(STATES_WAITING_FOR_BARRIER), 0 },
|
||||
{ "Wcvar", WITH_ID(STATES_WAITING_FOR_CONDITION_VARIABLE), 0 },
|
||||
{ "Wevnt", STATES_WAITING_FOR_EVENT, 0 },
|
||||
{ "Wisig", STATES_INTERRUPTIBLE_BY_SIGNAL, 0 },
|
||||
{ "Wjatx", STATES_WAITING_FOR_JOIN_AT_EXIT, 0 },
|
||||
{ "Wjoin", STATES_WAITING_FOR_JOIN, 0 },
|
||||
{ "Wmsg" , STATES_WAITING_FOR_MESSAGE, 0 },
|
||||
{ "Wmutex", STATES_WAITING_FOR_MUTEX, 0 },
|
||||
{ "Wmsg" , WITH_ID(STATES_WAITING_FOR_MESSAGE), 0 },
|
||||
{ "Wmutex", WITH_ID(STATES_WAITING_FOR_MUTEX), 0 },
|
||||
{ "WRATE", STATES_WAITING_FOR_PERIOD, 0 },
|
||||
{ "Wrpc", STATES_WAITING_FOR_RPC_REPLY, 0 },
|
||||
{ "Wrwlk", STATES_WAITING_FOR_RWLOCK, 0 },
|
||||
{ "Wrwlk", WITH_ID(STATES_WAITING_FOR_RWLOCK), 0 },
|
||||
{ "Wseg", STATES_WAITING_FOR_SEGMENT, 0 },
|
||||
{ "Wsem", STATES_WAITING_FOR_SEMAPHORE, 0 },
|
||||
{ "Wsem", WITH_ID(STATES_WAITING_FOR_SEMAPHORE), 0 },
|
||||
{ "Wsig", STATES_WAITING_FOR_SIGNAL, 0 },
|
||||
{ "Wslcnd", STATES_WAITING_FOR_SYS_LOCK_CONDITION, 0 },
|
||||
{ "Wslftx", STATES_WAITING_FOR_SYS_LOCK_FUTEX, 0 },
|
||||
{ "Wslmtx", STATES_WAITING_FOR_SYS_LOCK_MUTEX, 0 },
|
||||
{ "Wslsem", STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE, 0 },
|
||||
{ "Wcvar", STATES_WAITING_FOR_CONDITION_VARIABLE, 0 },
|
||||
{ "Wfutex", STATES_WAITING_FOR_FUTEX, 0 },
|
||||
{ "Wmutex", STATES_WAITING_FOR_MUTEX, 0 },
|
||||
{ "Wsem", STATES_WAITING_FOR_SEMAPHORE, 0 },
|
||||
{ "Wsysev", STATES_WAITING_FOR_SYSTEM_EVENT, 0 },
|
||||
{ "Wtime", STATES_WAITING_FOR_TIME, 0 },
|
||||
{ "Wwkup", STATES_WAITING_FOR_BSD_WAKEUP, 0 },
|
||||
|
||||
@@ -119,7 +119,8 @@ int _POSIX_Condition_variables_Wait_support(
|
||||
if ( !already_timedout ) {
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
&queue_context,
|
||||
STATES_WAITING_FOR_CONDITION_VARIABLE
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER
|
||||
| STATES_WAITING_FOR_CONDITION_VARIABLE
|
||||
);
|
||||
_Thread_queue_Context_set_enqueue_callout(
|
||||
&queue_context,
|
||||
|
||||
@@ -186,7 +186,7 @@ RTEMS_INLINE_ROUTINE Status_Control _CORE_semaphore_Seize(
|
||||
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_SEMAPHORE
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_SEMAPHORE
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -82,22 +82,26 @@ extern "C" {
|
||||
#define STATES_LIFE_IS_CHANGING 0x00800000
|
||||
/** This macro corresponds to a task waiting for a join. */
|
||||
#define STATES_WAITING_FOR_JOIN 0x01000000
|
||||
/** This macro corresponds to a task waiting for a <sys/lock.h> mutex. */
|
||||
#define STATES_WAITING_FOR_SYS_LOCK_MUTEX 0x02000000
|
||||
/** This macro corresponds to a task waiting for a <sys/lock.h> semaphore. */
|
||||
#define STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE 0x04000000
|
||||
/** This macro corresponds to a task waiting for a <sys/lock.h> futex. */
|
||||
#define STATES_WAITING_FOR_SYS_LOCK_FUTEX 0x08000000
|
||||
/** This macro corresponds to a task waiting for a futex. */
|
||||
#define STATES_WAITING_FOR_FUTEX 0x08000000
|
||||
|
||||
/** This macro corresponds to a task which is in an interruptible
|
||||
* blocking state.
|
||||
*/
|
||||
#define STATES_INTERRUPTIBLE_BY_SIGNAL 0x10000000
|
||||
/** This macro corresponds to a task waiting for a <sys/lock.h> condition. */
|
||||
#define STATES_WAITING_FOR_SYS_LOCK_CONDITION 0x20000000
|
||||
|
||||
/**
|
||||
* @brief This macro corresponds to a task which is blocked on a thread queue
|
||||
* embedded in an object with an identifier.
|
||||
*
|
||||
* This thread state bit is intended to ease debugging and improve system
|
||||
* diagnostics, see _Thread_Wait_get_id().
|
||||
*/
|
||||
#define STATES_THREAD_QUEUE_WITH_IDENTIFIER 0x80000000
|
||||
|
||||
/** This macro corresponds to a task waiting for a local object operation. */
|
||||
#define STATES_LOCALLY_BLOCKED ( STATES_WAITING_FOR_SEGMENT | \
|
||||
#define STATES_LOCALLY_BLOCKED ( STATES_THREAD_QUEUE_WITH_IDENTIFIER | \
|
||||
STATES_WAITING_FOR_SEGMENT | \
|
||||
STATES_WAITING_FOR_MESSAGE | \
|
||||
STATES_WAITING_FOR_SEMAPHORE | \
|
||||
STATES_WAITING_FOR_MUTEX | \
|
||||
@@ -106,10 +110,7 @@ extern "C" {
|
||||
STATES_WAITING_FOR_SIGNAL | \
|
||||
STATES_WAITING_FOR_BARRIER | \
|
||||
STATES_WAITING_FOR_BSD_WAKEUP | \
|
||||
STATES_WAITING_FOR_SYS_LOCK_MUTEX | \
|
||||
STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE | \
|
||||
STATES_WAITING_FOR_SYS_LOCK_FUTEX | \
|
||||
STATES_WAITING_FOR_SYS_LOCK_CONDITION | \
|
||||
STATES_WAITING_FOR_FUTEX | \
|
||||
STATES_WAITING_FOR_RWLOCK )
|
||||
|
||||
/** This macro corresponds to a task waiting which is blocked. */
|
||||
|
||||
@@ -111,7 +111,7 @@ static Thread_Control *_Condition_Do_wait(
|
||||
executing = _Condition_Queue_acquire_critical( condition, &context->Base );
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
&context->Base,
|
||||
STATES_WAITING_FOR_SYS_LOCK_CONDITION
|
||||
STATES_WAITING_FOR_CONDITION_VARIABLE
|
||||
);
|
||||
_Thread_queue_Context_set_enqueue_callout(
|
||||
&context->Base,
|
||||
|
||||
@@ -46,7 +46,7 @@ Status_Control _CORE_barrier_Seize(
|
||||
the_barrier->number_of_waiting_threads = number_of_waiting_threads;
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_BARRIER
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_BARRIER
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -115,7 +115,7 @@ Status_Control _CORE_message_queue_Seize(
|
||||
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_MESSAGE
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MESSAGE
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -133,7 +133,7 @@ Status_Control _CORE_message_queue_Submit(
|
||||
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_MESSAGE
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MESSAGE
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -34,7 +34,7 @@ Status_Control _CORE_mutex_Seize_slow(
|
||||
if ( wait ) {
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_MUTEX
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_MUTEX
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Context_set_deadlock_callout(
|
||||
|
||||
@@ -80,7 +80,7 @@ Status_Control _CORE_RWLock_Seize_for_reading(
|
||||
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_RWLOCK
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_RWLOCK
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -68,7 +68,7 @@ Status_Control _CORE_RWLock_Seize_for_writing(
|
||||
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_RWLOCK
|
||||
STATES_THREAD_QUEUE_WITH_IDENTIFIER | STATES_WAITING_FOR_RWLOCK
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Enqueue(
|
||||
|
||||
@@ -94,7 +94,7 @@ int _Futex_Wait( struct _Futex_Control *_futex, int *uaddr, int val )
|
||||
if ( *uaddr == val ) {
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
&queue_context,
|
||||
STATES_WAITING_FOR_SYS_LOCK_FUTEX
|
||||
STATES_WAITING_FOR_FUTEX
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context );
|
||||
_Thread_queue_Context_set_no_timeout( &queue_context );
|
||||
|
||||
@@ -111,7 +111,7 @@ static void _Mutex_Acquire_slow(
|
||||
{
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
queue_context,
|
||||
STATES_WAITING_FOR_SYS_LOCK_MUTEX
|
||||
STATES_WAITING_FOR_MUTEX
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( queue_context );
|
||||
_Thread_queue_Context_set_deadlock_callout(
|
||||
|
||||
@@ -105,7 +105,7 @@ void _Semaphore_Wait( struct _Semaphore_Control *_sem )
|
||||
} else {
|
||||
_Thread_queue_Context_set_thread_state(
|
||||
&queue_context,
|
||||
STATES_WAITING_FOR_SYS_LOCK_SEMAPHORE
|
||||
STATES_WAITING_FOR_SEMAPHORE
|
||||
);
|
||||
_Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context );
|
||||
_Thread_queue_Context_set_no_timeout( &queue_context );
|
||||
|
||||
@@ -18,14 +18,6 @@
|
||||
|
||||
#include <rtems/score/threadimpl.h>
|
||||
|
||||
#define THREAD_WAIT_QUEUE_OBJECT_STATES \
|
||||
( STATES_WAITING_FOR_BARRIER \
|
||||
| STATES_WAITING_FOR_CONDITION_VARIABLE \
|
||||
| STATES_WAITING_FOR_MESSAGE \
|
||||
| STATES_WAITING_FOR_MUTEX \
|
||||
| STATES_WAITING_FOR_RWLOCK \
|
||||
| STATES_WAITING_FOR_SEMAPHORE )
|
||||
|
||||
Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
|
||||
{
|
||||
States_Control current_state;
|
||||
@@ -38,7 +30,7 @@ Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread )
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( ( current_state & THREAD_WAIT_QUEUE_OBJECT_STATES ) != 0 ) {
|
||||
if ( ( current_state & STATES_THREAD_QUEUE_WITH_IDENTIFIER ) != 0 ) {
|
||||
const Thread_queue_Object *queue_object;
|
||||
|
||||
queue_object = THREAD_QUEUE_QUEUE_TO_OBJECT( the_thread->Wait.queue );
|
||||
|
||||
Reference in New Issue
Block a user