forked from Imagelibrary/rtems
testsuites: Replace _Thread_Get()
Replace _Thread_Get() with _Thread_Get_interrupt_disable() to avoid the Giant lock. Update #2555.
This commit is contained in:
@@ -118,12 +118,12 @@ static void busy_loop_task(rtems_task_argument arg)
|
||||
|
||||
static Thread_Control *get_thread_by_id(rtems_id task_id)
|
||||
{
|
||||
Objects_Locations location;
|
||||
ISR_lock_Context lock_context;
|
||||
Thread_Control *thread;
|
||||
|
||||
thread = _Thread_Get(task_id, &location);
|
||||
rtems_test_assert(location == OBJECTS_LOCAL);
|
||||
_Thread_Enable_dispatch();
|
||||
thread = _Thread_Get_interrupt_disable(task_id, &lock_context);
|
||||
rtems_test_assert(thread != NULL);
|
||||
_ISR_lock_ISR_enable(&lock_context);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
@@ -100,12 +100,12 @@ static rtems_id start_task(rtems_task_priority prio)
|
||||
|
||||
static Thread_Control *get_thread_by_id(rtems_id task_id)
|
||||
{
|
||||
Objects_Locations location;
|
||||
ISR_lock_Context lock_context;
|
||||
Thread_Control *thread;
|
||||
|
||||
thread = _Thread_Get(task_id, &location);
|
||||
rtems_test_assert(location == OBJECTS_LOCAL);
|
||||
_Thread_Enable_dispatch();
|
||||
thread = _Thread_Get_interrupt_disable(task_id, &lock_context);
|
||||
rtems_test_assert(thread != NULL);
|
||||
_ISR_lock_ISR_enable(&lock_context);
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
||||
@@ -42,13 +42,12 @@ static test_context ctx_instance;
|
||||
|
||||
static Thread_Control *get_tcb(rtems_id id)
|
||||
{
|
||||
Objects_Locations location;
|
||||
ISR_lock_Context lock_context;
|
||||
Thread_Control *tcb;
|
||||
|
||||
tcb = _Thread_Get(id, &location);
|
||||
_Objects_Put(&tcb->Object);
|
||||
|
||||
rtems_test_assert(tcb != NULL && location == OBJECTS_LOCAL);
|
||||
tcb = _Thread_Get_interrupt_disable(id, &lock_context);
|
||||
rtems_test_assert(tcb != NULL);
|
||||
_ISR_lock_ISR_enable(&lock_context);
|
||||
|
||||
return tcb;
|
||||
}
|
||||
|
||||
@@ -543,8 +543,9 @@ rtems_task Floating_point_task_2(
|
||||
|
||||
void complete_test( void )
|
||||
{
|
||||
uint32_t index;
|
||||
rtems_id task_id;
|
||||
uint32_t index;
|
||||
rtems_id task_id;
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
benchmark_timer_initialize();
|
||||
thread_resume( Middle_tcb );
|
||||
@@ -570,14 +571,14 @@ void complete_test( void )
|
||||
task_id = Middle_tcb->Object.id;
|
||||
|
||||
benchmark_timer_initialize();
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ )
|
||||
(void) _Thread_Get( task_id, &location );
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
|
||||
(void) _Thread_Get_interrupt_disable( task_id, &lock_context );
|
||||
_ISR_lock_ISR_enable( &lock_context );
|
||||
}
|
||||
thread_get_time = benchmark_timer_read();
|
||||
|
||||
benchmark_timer_initialize();
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
|
||||
ISR_lock_Context lock_context;
|
||||
|
||||
(void) _Semaphore_Get_interrupt_disable(
|
||||
Semaphore_id,
|
||||
&location,
|
||||
@@ -588,8 +589,10 @@ void complete_test( void )
|
||||
semaphore_get_time = benchmark_timer_read();
|
||||
|
||||
benchmark_timer_initialize();
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ )
|
||||
(void) _Thread_Get( 0x3, &location );
|
||||
for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
|
||||
(void) _Thread_Get_interrupt_disable( 0x3, &lock_context );
|
||||
_ISR_lock_ISR_enable( &lock_context );
|
||||
}
|
||||
thread_get_invalid_time = benchmark_timer_read();
|
||||
|
||||
/*
|
||||
@@ -755,7 +758,7 @@ void complete_test( void )
|
||||
);
|
||||
|
||||
put_time(
|
||||
"rtems internal: _Thread_Get",
|
||||
"rtems internal: _Thread_Get_interrupt_disable",
|
||||
thread_get_time,
|
||||
OPERATION_COUNT,
|
||||
0,
|
||||
@@ -763,7 +766,7 @@ void complete_test( void )
|
||||
);
|
||||
|
||||
put_time(
|
||||
"rtems internal: _Semaphore_Get",
|
||||
"rtems internal: _Semaphore_Get_interrupt_disable",
|
||||
semaphore_get_time,
|
||||
OPERATION_COUNT,
|
||||
0,
|
||||
@@ -771,7 +774,7 @@ void complete_test( void )
|
||||
);
|
||||
|
||||
put_time(
|
||||
"rtems internal: _Thread_Get: invalid id",
|
||||
"rtems internal: _Thread_Get_interrupt_disable: invalid id",
|
||||
thread_get_invalid_time,
|
||||
OPERATION_COUNT,
|
||||
0,
|
||||
|
||||
Reference in New Issue
Block a user