Changeset 7f6a24ab in rtems for cpukit/score/src/threadq.c


Ignore:
Timestamp:
Aug 28, 1995, 3:30:29 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
5072b07
Parents:
5250ff39
Message:

Added unused priority ceiling parameter to rtems_semaphore_create.

Rearranged code to created thread handler routines to initialize,
start, restart, and "close/delete" a thread.

Made internal threads their own object class. This now uses the
thread support routines for starting and initializing a thread.

Insured deleted tasks are freed to the Inactive pool associated with the
correct Information block.

Added an RTEMS API specific data area to the thread control block.

Beginnings of removing the word "rtems" from the core.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threadq.c

    r5250ff39 r7f6a24ab  
    3131 *  Input parameters:
    3232 *    the_thread_queue - pointer to a threadq header
    33  *    attribute_set    - used to determine queueing discipline
     33 *    the_class        - class of the object to which this belongs
     34 *    discipline       - queueing discipline
    3435 *    state            - state of waiting threads
    3536 *
     
    3839
    3940void _Thread_queue_Initialize(
    40   Thread_queue_Control *the_thread_queue,
    41   rtems_attribute           attribute_set,
    42   States_Control               state
     41  Thread_queue_Control         *the_thread_queue,
     42  Objects_Classes               the_class,
     43  Thread_queue_Disciplines      the_discipline,
     44  States_Control                state,
     45  Thread_queue_Extract_callout  proxy_extract_callout
    4346)
    4447{
    4548  unsigned32 index;
    4649
    47   if ( _Attributes_Is_priority( attribute_set ) ) {
    48     the_thread_queue->discipline = THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE;
    49     for( index=0 ;
    50          index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ;
    51          index++)
    52       _Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] );
    53   }
    54   else {
    55     the_thread_queue->discipline = THREAD_QUEUE_DATA_FIFO_DISCIPLINE;
    56     _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
    57   }
    58 
    59   the_thread_queue->state = state;
     50  _Thread_queue_Extract_table[ the_class ] = proxy_extract_callout;
     51
     52  the_thread_queue->state      = state;
     53  the_thread_queue->discipline = the_discipline;
     54
     55  switch ( the_discipline ) {
     56    case THREAD_QUEUE_DISCIPLINE_FIFO:
     57      _Chain_Initialize_empty( &the_thread_queue->Queues.Fifo );
     58      break;
     59    case THREAD_QUEUE_DISCIPLINE_PRIORITY:
     60      for( index=0 ;
     61           index < TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS ;
     62           index++)
     63        _Chain_Initialize_empty( &the_thread_queue->Queues.Priority[index] );
     64      break;
     65  }
    6066
    6167}
     
    108114
    109115  switch( the_thread_queue->discipline ) {
    110     case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
     116    case THREAD_QUEUE_DISCIPLINE_FIFO:
    111117      _Thread_queue_Enqueue_fifo( the_thread_queue, the_thread, timeout );
    112118      break;
    113     case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
     119    case THREAD_QUEUE_DISCIPLINE_PRIORITY:
    114120      _Thread_queue_Enqueue_priority(
    115121         the_thread_queue, the_thread, timeout );
     
    145151
    146152  switch ( the_thread_queue->discipline ) {
    147     case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
     153    case THREAD_QUEUE_DISCIPLINE_FIFO:
    148154      the_thread = _Thread_queue_Dequeue_fifo( the_thread_queue );
    149155      break;
    150     case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
     156    case THREAD_QUEUE_DISCIPLINE_PRIORITY:
    151157      the_thread = _Thread_queue_Dequeue_priority( the_thread_queue );
    152158      break;
     
    172178/*PAGE
    173179 *
     180 *  _Thread_queue_Extract_with_proxy
     181 *
     182 *  This routine extracts the_thread from the_thread_queue
     183 *  and insures that if there is a proxy for this task on
     184 *  another node, it is also dealt with.
     185 *
     186 *  XXX
     187 */
     188 
     189boolean _Thread_queue_Extract_with_proxy(
     190  Thread_Control       *the_thread
     191)
     192{
     193  States_Control                state;
     194  Objects_Classes               the_class;
     195  Thread_queue_Extract_callout  proxy_extract_callout;
     196
     197  state = the_thread->current_state;
     198
     199  if ( _States_Is_waiting_on_thread_queue( state ) ) {
     200    if ( _States_Is_waiting_for_rpc_reply( state ) &&
     201         _States_Is_locally_blocked( state ) ) {
     202
     203      the_class = rtems_get_class( the_thread->Wait.id );
     204
     205      proxy_extract_callout = _Thread_queue_Extract_table[ the_class ];
     206
     207      if ( proxy_extract_callout )
     208        (*proxy_extract_callout)( the_thread );
     209    }
     210    _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
     211
     212    return TRUE;
     213  }
     214  return FALSE;
     215}
     216
     217/*PAGE
     218 *
    174219 *  _Thread_queue_Extract
    175220 *
     
    192237{
    193238  switch ( the_thread_queue->discipline ) {
    194     case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
     239    case THREAD_QUEUE_DISCIPLINE_FIFO:
    195240      _Thread_queue_Extract_fifo( the_thread_queue, the_thread );
    196241      break;
    197     case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
     242    case THREAD_QUEUE_DISCIPLINE_PRIORITY:
    198243      _Thread_queue_Extract_priority( the_thread_queue, the_thread );
    199244      break;
     
    249294
    250295  switch ( the_thread_queue->discipline ) {
    251     case THREAD_QUEUE_DATA_FIFO_DISCIPLINE:
     296    case THREAD_QUEUE_DISCIPLINE_FIFO:
    252297      the_thread = _Thread_queue_First_fifo( the_thread_queue );
    253298      break;
    254     case THREAD_QUEUE_DATA_PRIORITY_DISCIPLINE:
     299    case THREAD_QUEUE_DISCIPLINE_PRIORITY:
    255300      the_thread = _Thread_queue_First_priority( the_thread_queue );
    256301      break;
     
    438483  if ( !_Watchdog_Is_active( &the_thread->Timer ) ) {
    439484    _ISR_Enable( level );
    440     _Thread_Unblock( the_thread );
    441485  } else {
    442486    _Watchdog_Deactivate( &the_thread->Timer );
    443487    _ISR_Enable( level );
    444488    (void) _Watchdog_Remove( &the_thread->Timer );
    445     _Thread_Unblock( the_thread );
    446   }
     489  }
     490
     491  _Thread_Unblock( the_thread );
    447492
    448493  if ( !_Objects_Is_local_id( the_thread->Object.id ) )
    449494    _Thread_MP_Free_proxy( the_thread );
     495 
    450496}
    451497
     
    499545)
    500546{
    501   rtems_task_priority       search_priority;
    502   Thread_Control *search_thread;
    503   ISR_Level              level;
    504   Chain_Control  *header;
    505   unsigned32             header_index;
    506   Chain_Node     *the_node;
    507   Chain_Node     *next_node;
    508   Chain_Node     *previous_node;
    509   Chain_Node     *search_node;
    510   rtems_task_priority       priority;
    511   States_Control         block_state;
     547  Priority_Control  search_priority;
     548  Thread_Control   *search_thread;
     549  ISR_Level         level;
     550  Chain_Control    *header;
     551  unsigned32        header_index;
     552  Chain_Node       *the_node;
     553  Chain_Node       *next_node;
     554  Chain_Node       *previous_node;
     555  Chain_Node       *search_node;
     556  Priority_Control  priority;
     557  States_Control    block_state;
    512558
    513559  _Chain_Initialize_empty( &the_thread->Wait.Block2n );
Note: See TracChangeset for help on using the changeset viewer.