Changeset d2bdf5c in rtems


Ignore:
Timestamp:
Mar 22, 2015, 10:58:10 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
a6524b9
Parents:
688fbc44
Message:

score: Move _Thread_queue_Requeue()

Now all the main thread queue operations are in one module.

Location:
cpukit/score
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r688fbc44 rd2bdf5c  
    299299## THREADQ_C_FILES
    300300libscore_a_SOURCES += src/threadq.c \
    301     src/threadqenqueue.c src/threadqrequeue.c \
     301    src/threadqenqueue.c \
    302302    src/threadqextractwithproxy.c src/threadqfirst.c \
    303303    src/threadqflush.c src/threadqprocesstimeout.c src/threadqtimeout.c
  • cpukit/score/src/threadqenqueue.c

    r688fbc44 rd2bdf5c  
    297297  return the_thread;
    298298}
     299
     300void _Thread_queue_Requeue(
     301  Thread_queue_Control *the_thread_queue,
     302  Thread_Control       *the_thread
     303)
     304{
     305  /*
     306   * Just in case the thread really wasn't blocked on a thread queue
     307   * when we get here.
     308   */
     309  if ( !the_thread_queue )
     310    return;
     311
     312  /*
     313   * If queueing by FIFO, there is nothing to do. This only applies to
     314   * priority blocking discipline.
     315   */
     316  if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
     317    Thread_queue_Control *tq = the_thread_queue;
     318    ISR_Level             level;
     319
     320    _ISR_Disable( level );
     321    if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
     322      _Thread_queue_Enter_critical_section( tq );
     323
     324      /* extract the thread */
     325      _RBTree_Extract(
     326        &the_thread->Wait.queue->Queues.Priority,
     327        &the_thread->RBNode
     328      );
     329
     330      /* enqueue the thread at the new priority */
     331      _RBTree_Insert(
     332        &the_thread_queue->Queues.Priority,
     333        &the_thread->RBNode,
     334        _Thread_queue_Compare_priority,
     335        false
     336      );
     337    }
     338    _ISR_Enable( level );
     339  }
     340}
Note: See TracChangeset for help on using the changeset viewer.