mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-20 13:33:26 +08:00
2007-05-10 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1241/rtems * score/src/threadchangepriority.c, score/src/threadqrequeue.c: Close critical section window added with requeueing support.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2007-05-10 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
PR 1241/rtems
|
||||
* score/src/threadchangepriority.c, score/src/threadqrequeue.c: Close
|
||||
critical section window added with requeueing support.
|
||||
|
||||
2007-05-10 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* libcsupport/include/rtems/cdefs.h,
|
||||
|
||||
@@ -95,13 +95,11 @@ void _Thread_Change_priority(
|
||||
*/
|
||||
state = the_thread->current_state;
|
||||
if ( state != STATES_TRANSIENT ) {
|
||||
if ( _States_Is_waiting_on_thread_queue( state ) ) {
|
||||
_ISR_Enable( level );
|
||||
_Thread_queue_Requeue( the_thread->Wait.queue, the_thread );
|
||||
_ISR_Disable( level ); /* redisable so state is cleared with ISR off */
|
||||
}
|
||||
the_thread->current_state = _States_Clear( STATES_TRANSIENT, state );
|
||||
_ISR_Enable( level );
|
||||
if ( _States_Is_waiting_on_thread_queue( state ) ) {
|
||||
_Thread_queue_Requeue( the_thread->Wait.queue, the_thread );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,9 @@ void _Thread_queue_Requeue(
|
||||
)
|
||||
{
|
||||
/* just in case the thread really wasn't blocked here */
|
||||
if ( !the_thread_queue )
|
||||
if ( !the_thread_queue ) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( the_thread_queue->discipline ) {
|
||||
case THREAD_QUEUE_DISCIPLINE_FIFO:
|
||||
@@ -56,12 +57,17 @@ void _Thread_queue_Requeue(
|
||||
break;
|
||||
case THREAD_QUEUE_DISCIPLINE_PRIORITY: {
|
||||
Thread_queue_Control *tq = the_thread_queue;
|
||||
ISR_Level level;
|
||||
|
||||
_Thread_queue_Enter_critical_section( tq );
|
||||
_ISR_Disable( level );
|
||||
if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
|
||||
_Thread_queue_Enter_critical_section( tq );
|
||||
_Thread_queue_Extract_priority_helper( tq, the_thread, TRUE );
|
||||
_Thread_queue_Enqueue_priority( tq, the_thread );
|
||||
}
|
||||
_ISR_Enable( level );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user