Changeset e41308ea in rtems


Ignore:
Timestamp:
Aug 22, 2016, 8:58:34 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1f210ac1
Parents:
114e408
git-author:
Sebastian Huber <sebastian.huber@…> (08/22/16 08:58:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (09/08/16 07:55:27)
Message:

score: Introduce Thread_queue_Lock_context

Introduce Thread_queue_Lock_context to contain the context necessary for
thread queue lock and thread wait lock acquire/release operations to
reduce the Thread_Control size.

Files:
35 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libnetworking/rtems/rtems_glue.c

    r114e408 re41308ea  
    376376                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
    377377        _Thread_queue_Context_initialize(&queue_context);
    378         _ISR_lock_ISR_disable(&queue_context.Lock_context);
     378        _ISR_lock_ISR_disable(&queue_context.Lock_context.Lock_context);
    379379        _Thread_queue_Context_set_no_timeout( &queue_context );
    380380        status = _CORE_recursive_mutex_Seize (
     
    410410                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
    411411        _Thread_queue_Context_initialize(&queue_context);
    412         _ISR_lock_ISR_disable(&queue_context.Lock_context);
     412        _ISR_lock_ISR_disable(&queue_context.Lock_context.Lock_context);
    413413        status = _CORE_recursive_mutex_Surrender(
    414414                &the_networkSemaphore->Core_control.Mutex.Recursive,
  • cpukit/posix/include/rtems/posix/barrierimpl.h

    r114e408 re41308ea  
    7272  return (POSIX_Barrier_Control *) _Objects_Get(
    7373    (Objects_Id) *barrier,
    74     &queue_context->Lock_context,
     74    &queue_context->Lock_context.Lock_context,
    7575    &_POSIX_Barrier_Information
    7676  );
  • cpukit/posix/include/rtems/posix/mqueueimpl.h

    r114e408 re41308ea  
    115115  return (POSIX_Message_queue_Control *) _Objects_Get(
    116116    id,
    117     &queue_context->Lock_context,
     117    &queue_context->Lock_context.Lock_context,
    118118    &_POSIX_Message_queue_Information
    119119  );
  • cpukit/posix/include/rtems/posix/posixapi.h

    r114e408 re41308ea  
    106106    return NULL; \
    107107  } \
    108   the_object = \
    109     _Objects_Get( (Objects_Id) *id, &queue_context->Lock_context, info ); \
     108  the_object = _Objects_Get( \
     109    (Objects_Id) *id, \
     110    &queue_context->Lock_context.Lock_context, \
     111    info \
     112  ); \
    110113  if ( the_object == NULL ) { \
    111114    _Once_Lock(); \
     
    114117    } \
    115118    _Once_Unlock(); \
    116     the_object = \
    117       _Objects_Get( (Objects_Id) *id, &queue_context->Lock_context, info ); \
     119    the_object = _Objects_Get( \
     120      (Objects_Id) *id, \
     121      &queue_context->Lock_context.Lock_context, \
     122      info \
     123    ); \
    118124  } \
    119125  return (type *) the_object
  • cpukit/posix/include/rtems/posix/semaphoreimpl.h

    r114e408 re41308ea  
    6565  return (POSIX_Semaphore_Control *) _Objects_Get(
    6666    (Objects_Id) *id,
    67     &queue_context->Lock_context,
     67    &queue_context->Lock_context.Lock_context,
    6868    &_POSIX_Semaphore_Information
    6969  );
  • cpukit/posix/src/condwaitsupp.c

    r114e408 re41308ea  
    9393  the_cond->mutex = *mutex;
    9494
    95   cpu_self = _Thread_Dispatch_disable_critical( &queue_context.Lock_context );
     95  cpu_self = _Thread_Dispatch_disable_critical(
     96    &queue_context.Lock_context.Lock_context
     97  );
    9698  executing = _Per_CPU_Get_executing( cpu_self );
    9799
  • cpukit/posix/src/mqueuerecvsupp.c

    r114e408 re41308ea  
    5959
    6060  if ( ( the_mq->oflag & O_ACCMODE ) == O_WRONLY ) {
    61     _ISR_lock_ISR_enable( &queue_context.Lock_context );
     61    _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    6262    rtems_set_errno_and_return_minus_one( EBADF );
    6363  }
    6464
    6565  if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
    66     _ISR_lock_ISR_enable( &queue_context.Lock_context );
     66    _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    6767    rtems_set_errno_and_return_minus_one( EMSGSIZE );
    6868  }
  • cpukit/posix/src/mqueuesendsupp.c

    r114e408 re41308ea  
    6666
    6767  if ( ( the_mq->oflag & O_ACCMODE ) == O_RDONLY ) {
    68     _ISR_lock_ISR_enable( &queue_context.Lock_context );
     68    _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    6969    rtems_set_errno_and_return_minus_one( EBADF );
    7070  }
  • cpukit/posix/src/pthreadgetschedparam.c

    r114e408 re41308ea  
    4646  }
    4747
    48   the_thread = _Thread_Get( thread, &queue_context.Lock_context );
     48  the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context );
    4949
    5050  if ( the_thread == NULL ) {
  • cpukit/posix/src/pthreadjoin.c

    r114e408 re41308ea  
    4242  _Thread_queue_Context_set_expected_level( &queue_context, 1 );
    4343  _Thread_queue_Context_set_no_timeout( &queue_context );
    44   the_thread = _Thread_Get( thread, &queue_context.Lock_context );
     44  the_thread = _Thread_Get( thread, &queue_context.Lock_context.Lock_context );
    4545
    4646  if ( the_thread == NULL ) {
     
    5252
    5353  if ( executing == the_thread ) {
    54     _ISR_lock_ISR_enable( &queue_context.Lock_context );
     54    _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    5555    return EDEADLK;
    5656  }
    5757
    58   _Thread_State_acquire_critical( the_thread, &queue_context.Lock_context );
     58  _Thread_State_acquire_critical(
     59    the_thread,
     60    &queue_context.Lock_context.Lock_context
     61  );
    5962
    6063  if ( !_Thread_Is_joinable( the_thread ) ) {
    61     _Thread_State_release( the_thread, &queue_context.Lock_context );
     64    _Thread_State_release( the_thread, &queue_context.Lock_context.Lock_context );
    6265    return EINVAL;
    6366  }
     
    6669    value = the_thread->Life.exit_value;
    6770    _Thread_Clear_state_locked( the_thread, STATES_WAITING_FOR_JOIN_AT_EXIT );
    68     _Thread_Dispatch_disable_with_CPU( cpu_self, &queue_context.Lock_context );
    69     _Thread_State_release( the_thread, &queue_context.Lock_context );
     71    _Thread_Dispatch_disable_with_CPU(
     72      cpu_self,
     73      &queue_context.Lock_context.Lock_context
     74    );
     75    _Thread_State_release( the_thread, &queue_context.Lock_context.Lock_context );
    7076    _Thread_Dispatch_enable( cpu_self );
    7177  } else {
  • cpukit/posix/src/semunlink.c

    r114e408 re41308ea  
    4141  _POSIX_Semaphore_Namespace_remove( the_semaphore );
    4242
    43   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     43  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    4444  _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &queue_context );
    4545  the_semaphore->linked = false;
  • cpukit/rtems/include/rtems/rtems/barrierimpl.h

    r114e408 re41308ea  
    7676{
    7777  _Thread_queue_Context_initialize( queue_context );
    78   return (Barrier_Control *)
    79     _Objects_Get( id, &queue_context->Lock_context, &_Barrier_Information );
     78  return (Barrier_Control *) _Objects_Get(
     79    id,
     80    &queue_context->Lock_context.Lock_context,
     81    &_Barrier_Information
     82  );
    8083}
    8184
  • cpukit/rtems/include/rtems/rtems/messageimpl.h

    r114e408 re41308ea  
    9696  return (Message_queue_Control *) _Objects_Get(
    9797    id,
    98     &queue_context->Lock_context,
     98    &queue_context->Lock_context.Lock_context,
    9999    &_Message_queue_Information
    100100  );
  • cpukit/rtems/include/rtems/rtems/semimpl.h

    r114e408 re41308ea  
    100100  return (Semaphore_Control *) _Objects_Get(
    101101    id,
    102     &queue_context->Lock_context,
     102    &queue_context->Lock_context.Lock_context,
    103103    &_Semaphore_Information
    104104  );
  • cpukit/rtems/src/semcreate.c

    r114e408 re41308ea  
    172172
    173173          _Thread_queue_Context_initialize( &queue_context );
    174           _ISR_lock_ISR_disable( &queue_context.Lock_context );
     174          _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    175175          _CORE_mutex_Acquire_critical(
    176176            &the_semaphore->Core_control.Mutex.Recursive.Mutex,
  • cpukit/rtems/src/tasksetscheduler.c

    r114e408 re41308ea  
    4646
    4747  _Thread_queue_Context_initialize( &queue_context );
    48   the_thread = _Thread_Get( task_id, &queue_context.Lock_context );
     48  the_thread = _Thread_Get( task_id, &queue_context.Lock_context.Lock_context );
    4949
    5050  if ( the_thread == NULL ) {
     
    5858  }
    5959
    60   cpu_self = _Thread_Dispatch_disable_critical( &queue_context.Lock_context );
     60  cpu_self = _Thread_Dispatch_disable_critical(
     61    &queue_context.Lock_context.Lock_context
     62  );
    6163
    6264  _Thread_Wait_acquire_critical( the_thread, &queue_context );
  • cpukit/score/include/rtems/score/coremuteximpl.h

    r114e408 re41308ea  
    409409  }
    410410
    411   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     411  cpu_self = _Thread_Dispatch_disable_critical(
     412    &queue_context->Lock_context.Lock_context
     413  );
    412414  _CORE_mutex_Release( &the_mutex->Recursive.Mutex, queue_context );
    413415  _Thread_Raise_priority( owner, priority_ceiling );
     
    525527      &the_mutex->Recursive.Mutex.Wait_queue.Queue,
    526528      new_owner,
    527       &queue_context->Lock_context
     529      &queue_context->Lock_context.Lock_context
    528530    );
    529531  } else {
  • cpukit/score/include/rtems/score/mrspimpl.h

    r114e408 re41308ea  
    127127  _Scheduler_Thread_change_help_state( new_owner, SCHEDULER_HELP_ACTIVE_OWNER );
    128128
    129   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     129  cpu_self = _Thread_Dispatch_disable_critical(
     130    &queue_context->Lock_context.Lock_context
     131  );
    130132  _MRSP_Release( mrsp, queue_context );
    131133
     
    208210
    209211  _Thread_queue_Context_initialize( &queue_context );
    210   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     212  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    211213  _MRSP_Acquire_critical( mrsp, &queue_context );
    212214
     
    271273  _MRSP_Giant_release( &giant_lock_context );
    272274
    273   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     275  cpu_self = _Thread_Dispatch_disable_critical(
     276    &queue_context->Lock_context.Lock_context
     277  );
    274278  _MRSP_Release( mrsp, queue_context );
    275279
     
    331335
    332336  if ( !priority_ok) {
    333     _ISR_lock_ISR_enable( &queue_context->Lock_context );
     337    _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    334338    return STATUS_MUTEX_CEILING_VIOLATED;
    335339  }
     
    378382
    379383  if ( _Resource_Get_owner( &mrsp->Resource ) != &executing->Resource_node ) {
    380     _ISR_lock_ISR_enable( &queue_context->Lock_context );
     384    _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    381385    return STATUS_NOT_OWNER;
    382386  }
     
    388392    )
    389393  ) {
    390     _ISR_lock_ISR_enable( &queue_context->Lock_context );
     394    _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    391395    return STATUS_RELEASE_ORDER_VIOLATION;
    392396  }
     
    429433  _MRSP_Giant_release( &giant_lock_context );
    430434
    431   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     435  cpu_self = _Thread_Dispatch_disable_critical(
     436    &queue_context->Lock_context.Lock_context
     437  );
    432438  _MRSP_Release( mrsp, queue_context );
    433439
  • cpukit/score/include/rtems/score/threadimpl.h

    r114e408 re41308ea  
    10321032#if defined(RTEMS_SMP)
    10331033#define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
    1034   RTEMS_CONTAINER_OF( node, Thread_queue_Context, Wait.Gate.Node )
     1034  RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
    10351035
    10361036RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request_locked(
    1037   Thread_Control       *the_thread,
    1038   Thread_queue_Context *queue_context
     1037  Thread_Control            *the_thread,
     1038  Thread_queue_Lock_context *queue_lock_context
    10391039)
    10401040{
    10411041  Chain_Node *first;
    10421042
    1043   _Chain_Extract_unprotected( &queue_context->Wait.Gate.Node );
     1043  _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
    10441044  first = _Chain_First( &the_thread->Wait.Lock.Pending_requests );
    10451045
     
    10501050
    10511051RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_queue_critical(
    1052   Thread_queue_Queue   *queue,
    1053   Thread_queue_Context *queue_context
     1052  Thread_queue_Queue        *queue,
     1053  Thread_queue_Lock_context *queue_lock_context
    10541054)
    10551055{
     
    10571057    queue,
    10581058    &_Thread_Executing->Potpourri_stats,
    1059     &queue_context->Lock_context
     1059    &queue_lock_context->Lock_context
    10601060  );
    10611061}
    10621062
    10631063RTEMS_INLINE_ROUTINE void _Thread_Wait_release_queue_critical(
    1064   Thread_queue_Queue   *queue,
    1065   Thread_queue_Context *queue_context
     1064  Thread_queue_Queue        *queue,
     1065  Thread_queue_Lock_context *queue_lock_context
    10661066)
    10671067{
    10681068  _Thread_queue_Queue_release_critical(
    10691069    queue,
    1070     &queue_context->Lock_context
     1070    &queue_lock_context->Lock_context
    10711071  );
    10721072}
     
    10931093  _Thread_Wait_acquire_default_critical(
    10941094    the_thread,
    1095     &queue_context->Lock_context
     1095    &queue_context->Lock_context.Lock_context
    10961096  );
    10971097
    10981098  queue = the_thread->Wait.queue;
    1099   queue_context->Wait.queue = queue;
     1099  queue_context->Lock_context.Wait.queue = queue;
    11001100
    11011101  if ( queue != NULL ) {
    11021102    _Thread_queue_Gate_add(
    11031103      &the_thread->Wait.Lock.Pending_requests,
    1104       &queue_context->Wait.Gate
     1104      &queue_context->Lock_context.Wait.Gate
    11051105    );
    11061106    _Thread_Wait_release_default_critical(
    11071107      the_thread,
    1108       &queue_context->Lock_context
     1108      &queue_context->Lock_context.Lock_context
    11091109    );
    1110     _Thread_Wait_acquire_queue_critical( queue, queue_context );
    1111 
    1112     if ( queue_context->Wait.queue == NULL ) {
    1113       _Thread_Wait_release_queue_critical( queue, queue_context );
     1110    _Thread_Wait_acquire_queue_critical( queue, &queue_context->Lock_context );
     1111
     1112    if ( queue_context->Lock_context.Wait.queue == NULL ) {
     1113      _Thread_Wait_release_queue_critical(
     1114        queue,
     1115        &queue_context->Lock_context
     1116      );
    11141117      _Thread_Wait_acquire_default_critical(
     1118        the_thread,
     1119        &queue_context->Lock_context.Lock_context
     1120      );
     1121      _Thread_Wait_remove_request_locked(
    11151122        the_thread,
    11161123        &queue_context->Lock_context
    11171124      );
    1118       _Thread_Wait_remove_request_locked( the_thread, queue_context );
    11191125      _Assert( the_thread->Wait.queue == NULL );
    11201126    }
     
    11391145{
    11401146  _Thread_queue_Context_initialize( queue_context );
    1141   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     1147  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    11421148  _Thread_Wait_acquire_critical( the_thread, queue_context );
    11431149}
     
    11611167  Thread_queue_Queue *queue;
    11621168
    1163   queue = queue_context->Wait.queue;
     1169  queue = queue_context->Lock_context.Wait.queue;
    11641170
    11651171  if ( queue != NULL ) {
    1166     _Thread_Wait_release_queue_critical( queue, queue_context );
     1172    _Thread_Wait_release_queue_critical(
     1173      queue, &queue_context->Lock_context
     1174    );
    11671175    _Thread_Wait_acquire_default_critical(
     1176      the_thread,
     1177      &queue_context->Lock_context.Lock_context
     1178    );
     1179    _Thread_Wait_remove_request_locked(
    11681180      the_thread,
    11691181      &queue_context->Lock_context
    11701182    );
    1171 
    1172     _Thread_Wait_remove_request_locked( the_thread, queue_context );
    11731183  }
    11741184
    11751185  _Thread_Wait_release_default_critical(
    11761186    the_thread,
    1177     &queue_context->Lock_context
     1187    &queue_context->Lock_context.Lock_context
    11781188  );
    11791189#else
     
    11971207{
    11981208  _Thread_Wait_release_critical( the_thread, queue_context );
    1199   _ISR_lock_ISR_enable( &queue_context->Lock_context );
     1209  _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    12001210}
    12011211
     
    12441254 *
    12451255 * @param[in] the_thread The thread.
    1246  * @param[in] queue_context The thread queue context used for corresponding
    1247  *   _Thread_Wait_acquire().
     1256 * @param[in] queue_lock_context The thread queue lock context used for
     1257 *   corresponding _Thread_Wait_acquire().
    12481258 */
    12491259RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request(
    1250   Thread_Control       *the_thread,
    1251   Thread_queue_Context *queue_context
     1260  Thread_Control            *the_thread,
     1261  Thread_queue_Lock_context *queue_lock_context
    12521262)
    12531263{
     
    12561266
    12571267  _Thread_Wait_acquire_default( the_thread, &lock_context );
    1258   _Thread_Wait_remove_request_locked( the_thread, queue_context );
     1268  _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
    12591269  _Thread_Wait_release_default( the_thread, &lock_context );
    12601270#else
    12611271  (void) the_thread;
    1262   (void) queue_context;
     1272  (void) queue_lock_context;
    12631273#endif
    12641274}
     
    12951305
    12961306      queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
    1297       queue_context->Wait.queue = NULL;
     1307      queue_context->Lock_context.Wait.queue = NULL;
    12981308
    12991309      node = _Chain_Next( node );
     
    13641374#if defined(RTEMS_SMP)
    13651375  if ( queue != NULL ) {
    1366     _Assert( queue_context->Wait.queue == queue );
     1376    _Assert( queue_context->Lock_context.Wait.queue == queue );
    13671377#endif
    13681378
     
    13711381
    13721382#if defined(RTEMS_SMP)
    1373     _Assert( queue_context->Wait.queue == NULL );
    1374     queue_context->Wait.queue = queue;
     1383    _Assert( queue_context->Lock_context.Wait.queue == NULL );
     1384    queue_context->Lock_context.Wait.queue = queue;
    13751385  }
    13761386#endif
  • cpukit/score/include/rtems/score/threadq.h

    r114e408 re41308ea  
    9696#endif
    9797
    98 /**
    99  * @brief Thread queue context for the thread queue methods.
    100  *
    101  * @see _Thread_queue_Context_initialize().
    102  */
    10398typedef struct {
    10499  /**
     
    107102   */
    108103  ISR_lock_Context Lock_context;
    109 
    110   /**
    111    * @brief The expected thread dispatch disable level for
    112    * _Thread_queue_Enqueue_critical().
    113    *
    114    * In case the actual thread dispatch disable level is not equal to the
    115    * expected level, then a fatal error occurs.
    116    */
    117   uint32_t expected_thread_dispatch_disable_level;
    118 
    119   /**
    120    * @brief The clock discipline for the interval timeout.
    121    * Use WATCHDOG_NO_TIMEOUT to block indefinitely.
    122    */
    123   Watchdog_Discipline timeout_discipline;
    124 
    125   /**
    126    * @brief Interval to wait.
    127    */
    128   uint64_t timeout;
    129 
    130   /**
    131    * @brief Invoked in case of a detected deadlock.
    132    *
    133    * Must be initialized for _Thread_queue_Enqueue_critical() in case the
    134    * thread queue may have an owner, e.g. for mutex objects.
    135    *
    136    * @see _Thread_queue_Context_set_deadlock_callout().
    137    */
    138   Thread_queue_Deadlock_callout deadlock_callout;
    139 
    140 #if defined(RTEMS_MULTIPROCESSING)
    141   /**
    142    * @brief Callout to unblock the thread in case it is actually a thread
    143    * proxy.
    144    *
    145    * This field is only used on multiprocessing configurations.  Used by
    146    * thread queue extract and unblock methods for objects with multiprocessing
    147    * (MP) support.
    148    *
    149    * @see _Thread_queue_Context_set_MP_callout().
    150    */
    151   Thread_queue_MP_callout mp_callout;
    152 #endif
    153104
    154105#if defined(RTEMS_SMP)
     
    170121  } Wait;
    171122#endif
    172 } Thread_queue_Context;
     123} Thread_queue_Lock_context;
    173124
    174125#if defined(RTEMS_SMP)
     
    206157
    207158  /**
    208    * @brief The queue context used to acquire the thread wait lock of the
     159   * @brief The queue lock context used to acquire the thread wait lock of the
    209160   * owner.
    210161   */
    211   Thread_queue_Context Queue_context;
     162  Thread_queue_Lock_context Lock_context;
    212163} Thread_queue_Link;
    213164#endif
     165
     166/**
     167 * @brief Thread queue context for the thread queue methods.
     168 *
     169 * @see _Thread_queue_Context_initialize().
     170 */
     171typedef struct {
     172  /**
     173   * @brief The lock context for the thread queue acquire and release
     174   * operations.
     175   */
     176  Thread_queue_Lock_context Lock_context;
     177
     178  /**
     179   * @brief The expected thread dispatch disable level for
     180   * _Thread_queue_Enqueue_critical().
     181   *
     182   * In case the actual thread dispatch disable level is not equal to the
     183   * expected level, then a fatal error occurs.
     184   */
     185  uint32_t expected_thread_dispatch_disable_level;
     186
     187  /**
     188   * @brief The clock discipline for the interval timeout.
     189   * Use WATCHDOG_NO_TIMEOUT to block indefinitely.
     190   */
     191  Watchdog_Discipline timeout_discipline;
     192
     193  /**
     194   * @brief Interval to wait.
     195   */
     196  uint64_t timeout;
     197
     198  /**
     199   * @brief Invoked in case of a detected deadlock.
     200   *
     201   * Must be initialized for _Thread_queue_Enqueue_critical() in case the
     202   * thread queue may have an owner, e.g. for mutex objects.
     203   *
     204   * @see _Thread_queue_Context_set_deadlock_callout().
     205   */
     206  Thread_queue_Deadlock_callout deadlock_callout;
     207
     208#if defined(RTEMS_MULTIPROCESSING)
     209  /**
     210   * @brief Callout to unblock the thread in case it is actually a thread
     211   * proxy.
     212   *
     213   * This field is only used on multiprocessing configurations.  Used by
     214   * thread queue extract and unblock methods for objects with multiprocessing
     215   * (MP) support.
     216   *
     217   * @see _Thread_queue_Context_set_MP_callout().
     218   */
     219  Thread_queue_MP_callout mp_callout;
     220#endif
     221} Thread_queue_Context;
    214222
    215223/**
  • cpukit/score/include/rtems/score/threadqimpl.h

    r114e408 re41308ea  
    373373  _Thread_queue_Do_acquire_critical(
    374374    the_thread_queue,
    375     &queue_context->Lock_context
     375    &queue_context->Lock_context.Lock_context
    376376  );
    377377}
     
    382382)
    383383{
    384   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     384  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    385385  _Thread_queue_Acquire_critical( the_thread_queue, queue_context );
    386386}
     
    423423  _Thread_queue_Do_release_critical(
    424424    the_thread_queue,
    425     &queue_context->Lock_context
     425    &queue_context->Lock_context.Lock_context
    426426  );
    427427}
     
    433433{
    434434  _Thread_queue_Release_critical( the_thread_queue, queue_context );
    435   _ISR_lock_ISR_enable( &queue_context->Lock_context );
     435  _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    436436}
    437437
     
    512512 *
    513513 *   _Thread_queue_Context_initialize( &queue_context );
    514  *   _Thread_queue_Acquire( &mutex->Queue, &queue_context.Lock_context );
     514 *   _Thread_queue_Acquire( &mutex->Queue, queue_context );
    515515 *
    516516 *   executing = _Thread_Executing;
     
    518518 *   if ( mutex->owner == NULL ) {
    519519 *     mutex->owner = executing;
    520  *     _Thread_queue_Release( &mutex->Queue, &queue_context.Lock_context );
     520 *     _Thread_queue_Release( &mutex->Queue, queue_context );
    521521 *   } else {
    522522 *     _Thread_queue_Context_set_expected_level( &queue_context, 1 );
  • cpukit/score/src/apimutexlock.c

    r114e408 re41308ea  
    3333
    3434  _Thread_queue_Context_initialize( &queue_context );
    35   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     35  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    3636  _Thread_queue_Context_set_no_timeout( &queue_context );
    3737  _CORE_recursive_mutex_Seize(
  • cpukit/score/src/apimutexunlock.c

    r114e408 re41308ea  
    3333
    3434  _Thread_queue_Context_initialize( &queue_context );
    35   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     35  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    3636  _CORE_recursive_mutex_Surrender(
    3737    &the_mutex->Mutex,
  • cpukit/score/src/condition.c

    r114e408 re41308ea  
    6464    &condition->Queue.Queue,
    6565    &executing->Potpourri_stats,
    66     &queue_context->Lock_context
     66    &queue_context->Lock_context.Lock_context
    6767  );
    6868
     
    7777  _Thread_queue_Queue_release(
    7878    &condition->Queue.Queue,
    79     &queue_context->Lock_context
     79    &queue_context->Lock_context.Lock_context
    8080  );
    8181}
     
    9292  condition = _Condition_Get( _condition );
    9393  executing = _Condition_Queue_acquire_critical( condition, queue_context );
    94   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     94  cpu_self = _Thread_Dispatch_disable_critical(
     95    &queue_context->Lock_context.Lock_context
     96  );
    9597
    9698  _Thread_queue_Context_set_expected_level( queue_context, 2 );
     
    115117
    116118  _Thread_queue_Context_initialize( &queue_context );
    117   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     119  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    118120  _Thread_queue_Context_set_no_timeout( &queue_context );
    119121  cpu_self = _Condition_Do_wait(
     
    140142
    141143  _Thread_queue_Context_initialize( &queue_context );
    142   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     144  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    143145
    144146  switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    145147    case TOD_ABSOLUTE_TIMEOUT_INVALID:
    146       _ISR_lock_ISR_enable( &queue_context.Lock_context );
     148      _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    147149      return EINVAL;
    148150    case TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST:
    149151    case TOD_ABSOLUTE_TIMEOUT_IS_NOW:
    150       _ISR_lock_ISR_enable( &queue_context.Lock_context );
     152      _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    151153      return ETIMEDOUT;
    152154    default:
     
    176178
    177179  _Thread_queue_Context_initialize( &queue_context );
    178   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     180  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    179181  _Thread_queue_Context_set_no_timeout( &queue_context );
    180182  cpu_self = _Condition_Do_wait( _condition, &queue_context );
     
    202204
    203205  _Thread_queue_Context_initialize( &queue_context );
    204   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     206  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    205207
    206208  switch ( _TOD_Absolute_timeout_to_ticks( abstime, CLOCK_REALTIME, &ticks ) ) {
    207209    case TOD_ABSOLUTE_TIMEOUT_INVALID:
    208       _ISR_lock_ISR_enable( &queue_context.Lock_context );
     210      _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    209211      return EINVAL;
    210212    case TOD_ABSOLUTE_TIMEOUT_IS_IN_PAST:
    211213    case TOD_ABSOLUTE_TIMEOUT_IS_NOW:
    212       _ISR_lock_ISR_enable( &queue_context.Lock_context );
     214      _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    213215      return ETIMEDOUT;
    214216    default:
     
    262264  condition = _Condition_Get( _condition );
    263265  _Thread_queue_Context_initialize( &context.Base );
    264   _ISR_lock_ISR_disable( &context.Base.Lock_context );
     266  _ISR_lock_ISR_disable( &context.Base.Lock_context.Lock_context );
    265267  _Condition_Queue_acquire_critical( condition, &context.Base );
    266268
  • cpukit/score/src/coremsgbroadcast.c

    r114e408 re41308ea  
    3434
    3535  if ( size > the_message_queue->maximum_message_size ) {
    36     _ISR_lock_ISR_enable( &queue_context->Lock_context );
     36    _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
    3737    return STATUS_MESSAGE_INVALID_SIZE;
    3838  }
  • cpukit/score/src/coremutexseize.c

    r114e408 re41308ea  
    5858  _Thread_queue_Context_set_expected_level( queue_context, 1 );
    5959#else
    60   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     60  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    6161  _CORE_mutex_Acquire_critical( the_mutex, queue_context );
    6262  _Thread_queue_Context_set_expected_level( queue_context, 2 );
  • cpukit/score/src/futex.c

    r114e408 re41308ea  
    5656  Thread_Control *executing;
    5757
    58   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     58  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    5959  executing = _Thread_Executing;
    6060  _Thread_queue_Queue_acquire_critical(
    6161    &futex->Queue.Queue,
    6262    &executing->Potpourri_stats,
    63     &queue_context->Lock_context
     63    &queue_context->Lock_context.Lock_context
    6464  );
    6565
     
    7474  _Thread_queue_Queue_release(
    7575    &futex->Queue.Queue,
    76     &queue_context->Lock_context
     76    &queue_context->Lock_context.Lock_context
    7777  );
    7878}
  • cpukit/score/src/mpci.c

    r114e408 re41308ea  
    336336    executing->receive_packet = NULL;
    337337
    338     _ISR_lock_ISR_disable( &queue_context.Lock_context );
     338    _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    339339    _CORE_semaphore_Seize(
    340340      &_MPCI_Semaphore,
     
    376376  Thread_queue_Context queue_context;
    377377
    378   _ISR_lock_ISR_disable( &queue_context.Lock_context );
     378  _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
    379379  (void) _CORE_semaphore_Surrender(
    380380    &_MPCI_Semaphore,
  • cpukit/score/src/mutex.c

    r114e408 re41308ea  
    7979  Thread_Control *executing;
    8080
    81   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     81  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    8282  executing = _Thread_Executing;
    8383  _Thread_queue_Queue_acquire_critical(
    8484    &mutex->Queue.Queue,
    8585    &executing->Potpourri_stats,
    86     &queue_context->Lock_context
     86    &queue_context->Lock_context.Lock_context
    8787  );
    8888
     
    9797  _Thread_queue_Queue_release(
    9898    &mutex->Queue.Queue,
    99     &queue_context->Lock_context
     99    &queue_context->Lock_context.Lock_context
    100100  );
    101101}
  • cpukit/score/src/semaphore.c

    r114e408 re41308ea  
    6363  Thread_Control *executing;
    6464
    65   _ISR_lock_ISR_disable( &queue_context->Lock_context );
     65  _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
    6666  executing = _Thread_Executing;
    6767  _Thread_queue_Queue_acquire_critical(
    6868    &sem->Queue.Queue,
    6969    &executing->Potpourri_stats,
    70     &queue_context->Lock_context
     70    &queue_context->Lock_context.Lock_context
    7171  );
    7272
     
    8181  _Thread_queue_Queue_release(
    8282    &sem->Queue.Queue,
    83     &queue_context->Lock_context
     83    &queue_context->Lock_context.Lock_context
    8484  );
    8585}
  • cpukit/score/src/threadqenqueue.c

    r114e408 re41308ea  
    185185    link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
    186186
    187     if ( link->Queue_context.Wait.queue == NULL ) {
     187    if ( link->Lock_context.Wait.queue == NULL ) {
    188188      _Thread_Wait_release_default_critical(
    189189        link->owner,
    190         &link->Queue_context.Lock_context
     190        &link->Lock_context.Lock_context
    191191      );
    192192
     
    200200      /* The other links have an owner which waits on a thread queue */
    201201      link = THREAD_QUEUE_LINK_OF_PATH_NODE( node );
    202       _Assert( link->Queue_context.Wait.queue != NULL );
     202      _Assert( link->Lock_context.Wait.queue != NULL );
    203203
    204204      _Thread_queue_Link_remove( link );
    205205      _Thread_Wait_release_queue_critical(
    206         link->Queue_context.Wait.queue,
    207         &link->Queue_context
     206        link->Lock_context.Wait.queue,
     207        &link->Lock_context
    208208      );
    209       _Thread_Wait_remove_request( link->owner, &link->Queue_context );
     209      _Thread_Wait_remove_request( link->owner, &link->Lock_context );
    210210
    211211      node = _Chain_Previous( node );
     
    254254  _RBTree_Initialize_node( &path->Start.Registry_node );
    255255  _Chain_Initialize_node( &path->Start.Path_node );
    256   _Thread_queue_Context_initialize( &path->Start.Queue_context );
     256  _Chain_Initialize_node( &path->Start.Lock_context.Wait.Gate.Node );
    257257  link = &path->Start;
    258258
     
    263263    _Thread_Wait_acquire_default_critical(
    264264      owner,
    265       &link->Queue_context.Lock_context
     265      &link->Lock_context.Lock_context
    266266    );
    267267
    268268    target = owner->Wait.queue;
    269     link->Queue_context.Wait.queue = target;
     269    link->Lock_context.Wait.queue = target;
    270270
    271271    if ( target != NULL ) {
     
    273273        _Thread_queue_Gate_add(
    274274          &owner->Wait.Lock.Pending_requests,
    275           &link->Queue_context.Wait.Gate
     275          &link->Lock_context.Wait.Gate
    276276        );
    277277        _Thread_Wait_release_default_critical(
    278278          owner,
    279           &link->Queue_context.Lock_context
     279          &link->Lock_context.Lock_context
    280280        );
    281         _Thread_Wait_acquire_queue_critical( target, &link->Queue_context );
    282 
    283         if ( link->Queue_context.Wait.queue == NULL ) {
     281        _Thread_Wait_acquire_queue_critical( target, &link->Lock_context );
     282
     283        if ( link->Lock_context.Wait.queue == NULL ) {
    284284          _Thread_queue_Link_remove( link );
    285           _Thread_Wait_release_queue_critical( target, &link->Queue_context );
     285          _Thread_Wait_release_queue_critical( target, &link->Lock_context );
    286286          _Thread_Wait_acquire_default_critical(
    287287            owner,
    288             &link->Queue_context.Lock_context
     288            &link->Lock_context.Lock_context
    289289          );
    290           _Thread_Wait_remove_request_locked( owner, &link->Queue_context );
     290          _Thread_Wait_remove_request_locked( owner, &link->Lock_context );
    291291          _Assert( owner->Wait.queue == NULL );
    292292          return true;
    293293        }
    294294      } else {
    295         link->Queue_context.Wait.queue = NULL;
     295        link->Lock_context.Wait.queue = NULL;
    296296        _Thread_queue_Path_release( path );
    297297        return false;
     
    360360  if ( !_Thread_queue_Path_acquire( the_thread, queue, &path ) ) {
    361361    _Thread_Wait_restore_default( the_thread );
    362     _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
     362    _Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
    363363    _Thread_Wait_tranquilize( the_thread );
    364364    ( *queue_context->deadlock_callout )( the_thread );
     
    372372  the_thread->Wait.return_code = STATUS_SUCCESSFUL;
    373373  _Thread_Wait_flags_set( the_thread, THREAD_QUEUE_INTEND_TO_BLOCK );
    374   cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
    375   _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
     374  cpu_self = _Thread_Dispatch_disable_critical(
     375    &queue_context->Lock_context.Lock_context
     376  );
     377  _Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
    376378
    377379  if (
     
    545547    queue,
    546548    the_thread,
    547     &queue_context->Lock_context
     549    &queue_context->Lock_context.Lock_context
    548550  );
    549551}
     
    562564    bool unblock;
    563565
    564     _Thread_Wait_remove_request( the_thread, &queue_context );
     566    _Thread_Wait_remove_request( the_thread, &queue_context.Lock_context );
    565567    _Thread_queue_Context_set_MP_callout(
    566568      &queue_context,
     
    577579      queue,
    578580      the_thread,
    579       &queue_context.Lock_context
     581      &queue_context.Lock_context.Lock_context
    580582    );
    581583  } else {
     
    613615      queue,
    614616      new_owner,
    615       &queue_context->Lock_context
     617      &queue_context->Lock_context.Lock_context
    616618    );
    617619  } else {
    618     _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
     620    _Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
    619621  }
    620622
  • cpukit/score/src/threadqflush.c

    r114e408 re41308ea  
    110110
    111111    cpu_self = _Thread_Dispatch_disable_critical(
    112       &queue_context->Lock_context
     112      &queue_context->Lock_context.Lock_context
    113113    );
    114     _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
     114    _Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
    115115
    116116    do {
     
    127127    _Thread_Dispatch_enable( cpu_self );
    128128  } else {
    129     _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
     129    _Thread_queue_Queue_release( queue, &queue_context->Lock_context.Lock_context );
    130130  }
    131131
  • cpukit/score/src/threadrestart.c

    r114e408 re41308ea  
    537537  _Thread_queue_Context_set_expected_level( &queue_context, 2 );
    538538  _Thread_queue_Context_set_no_timeout( &queue_context );
    539   _Thread_State_acquire( the_thread, &queue_context.Lock_context );
     539  _Thread_State_acquire( the_thread, &queue_context.Lock_context.Lock_context );
    540540  _Thread_Join(
    541541    the_thread,
  • testsuites/sptests/spintrcritical22/init.c

    r114e408 re41308ea  
    3939  sem = _Semaphore_Get(id, &queue_context);
    4040  rtems_test_assert(sem != NULL);
    41   _ISR_lock_ISR_enable(&queue_context.Lock_context);
     41  _ISR_lock_ISR_enable(&queue_context.Lock_context.Lock_context);
    4242
    4343  return sem;
  • testsuites/tmtests/tm26/task1.c

    r114e408 re41308ea  
    516516    for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
    517517      (void) _Semaphore_Get( Semaphore_id, &queue_context );
    518       _ISR_lock_ISR_enable( &queue_context.Lock_context );
     518      _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
    519519    }
    520520  semaphore_get_time = benchmark_timer_read();
Note: See TracChangeset for help on using the changeset viewer.