Changeset 631b3c8 in rtems


Ignore:
Timestamp:
May 23, 2016, 9:40:18 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
9ec7d492
Parents:
c3d8d9e
git-author:
Sebastian Huber <sebastian.huber@…> (05/23/16 09:40:18)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/25/16 10:43:54)
Message:

score: Move thread queue MP callout to context

Drop the multiprocessing (MP) dependent callout parameter from the
thread queue extract, dequeue, flush and unblock methods. Merge this
parameter with the lock context into new structure Thread_queue_Context.
This helps to gets rid of the conditionally compiled method call
helpers.

Files:
98 edited

Legend:

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

    rc3d8d9e r631b3c8  
    372372{
    373373#ifdef RTEMS_FAST_MUTEX
    374         ISR_lock_Context lock_context;
     374        Thread_queue_Context queue_context;
    375375        Thread_Control *executing;
    376         _ISR_lock_ISR_disable(&lock_context);
    377376        if (!the_networkSemaphore)
    378377                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
     378        _Thread_queue_Context_initialize(&queue_context, NULL);
     379        _ISR_lock_ISR_disable(&queue_context.Lock_context);
    379380        executing = _Thread_Executing;
    380381        _CORE_mutex_Seize (
     
    383384                1,              /* wait */
    384385                0,              /* forever */
    385                 &lock_context
     386                &queue_context
    386387                );
    387388        if (executing->Wait.return_code)
     
    405406{
    406407#ifdef RTEMS_FAST_MUTEX
    407         ISR_lock_Context lock_context;
     408        Thread_queue_Context queue_context;
    408409        CORE_mutex_Status status;
    409410
    410411        if (!the_networkSemaphore)
    411412                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
    412         _ISR_lock_ISR_disable(&lock_context);
     413        _Thread_queue_Context_initialize(&queue_context, NULL);
     414        _ISR_lock_ISR_disable(&queue_context.Lock_context);
    413415        status = _CORE_mutex_Surrender (
    414416                &the_networkSemaphore->Core_control.mutex,
    415                 NULL,
    416                 &lock_context
     417                &queue_context
    417418                );
    418419        if (status != CORE_MUTEX_STATUS_SUCCESSFUL)
  • cpukit/posix/include/rtems/posix/barrierimpl.h

    rc3d8d9e r631b3c8  
    7878}
    7979
    80 RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get (
     80RTEMS_INLINE_ROUTINE POSIX_Barrier_Control *_POSIX_Barrier_Get(
    8181  const pthread_barrier_t *barrier,
    82   ISR_lock_Context        *lock_context
     82  Thread_queue_Context    *queue_context
    8383)
    8484{
     85  _Thread_queue_Context_initialize( queue_context, NULL );
    8586  return (POSIX_Barrier_Control *) _Objects_Get(
    8687    (Objects_Id) *barrier,
    87     lock_context,
     88    &queue_context->Lock_context,
    8889    &_POSIX_Barrier_Information
    8990  );
  • cpukit/posix/include/rtems/posix/condimpl.h

    rc3d8d9e r631b3c8  
    6464RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Acquire_critical(
    6565  POSIX_Condition_variables_Control *the_cond,
    66   ISR_lock_Context                  *lock_context
     66  Thread_queue_Context              *queue_context
    6767)
    6868{
    69   _Thread_queue_Acquire_critical( &the_cond->Wait_queue, lock_context );
     69  _Thread_queue_Acquire_critical(
     70    &the_cond->Wait_queue,
     71    &queue_context->Lock_context
     72  );
    7073}
    7174
    7275RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Release(
    7376  POSIX_Condition_variables_Control *the_cond,
    74   ISR_lock_Context                  *lock_context
     77  Thread_queue_Context              *queue_context
    7578)
    7679{
    77   _Thread_queue_Release( &the_cond->Wait_queue, lock_context );
     80  _Thread_queue_Release( &the_cond->Wait_queue, &queue_context->Lock_context );
    7881}
    7982
     
    108111
    109112POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get(
    110   pthread_cond_t   *cond,
    111   ISR_lock_Context *lock_context
     113  pthread_cond_t       *cond,
     114  Thread_queue_Context *queue_context
    112115);
    113116
  • cpukit/posix/include/rtems/posix/mqueueimpl.h

    rc3d8d9e r631b3c8  
    4444void _POSIX_Message_queue_Delete(
    4545  POSIX_Message_queue_Control *the_mq,
    46   ISR_lock_Context            *lock_context
     46  Thread_queue_Context        *queue_context
    4747);
    4848
     
    108108
    109109RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get(
    110   Objects_Id        id,
    111   ISR_lock_Context *lock_context
     110  Objects_Id            id,
     111  Thread_queue_Context *queue_context
    112112)
    113113{
    114   return (POSIX_Message_queue_Control *)
    115     _Objects_Get( id, lock_context, &_POSIX_Message_queue_Information );
     114  _Thread_queue_Context_initialize( queue_context, NULL );
     115  return (POSIX_Message_queue_Control *) _Objects_Get(
     116    id,
     117    &queue_context->Lock_context,
     118    &_POSIX_Message_queue_Information
     119  );
    116120}
    117121
  • cpukit/posix/include/rtems/posix/muteximpl.h

    rc3d8d9e r631b3c8  
    128128 */
    129129POSIX_Mutex_Control *_POSIX_Mutex_Get(
    130   pthread_mutex_t  *mutex,
    131   ISR_lock_Context *lock_context
     130  pthread_mutex_t      *mutex,
     131  Thread_queue_Context *queue_context
    132132);
    133133
  • cpukit/posix/include/rtems/posix/posixapi.h

    rc3d8d9e r631b3c8  
    7272  type, \
    7373  id, \
    74   lock_context, \
     74  queue_context, \
    7575  info, \
    7676  initializer, \
     
    8181    return NULL; \
    8282  } \
    83   the_object = _Objects_Get( (Objects_Id) *id, lock_context, info ); \
     83  the_object = \
     84    _Objects_Get( (Objects_Id) *id, &queue_context->Lock_context, info ); \
    8485  if ( the_object == NULL ) { \
    8586    _Once_Lock(); \
     
    8889    } \
    8990    _Once_Unlock(); \
    90     the_object = _Objects_Get( (Objects_Id) *id, lock_context, info ); \
     91    the_object = \
     92      _Objects_Get( (Objects_Id) *id, &queue_context->Lock_context, info ); \
    9193  } \
    9294  return (type *) the_object
  • cpukit/posix/include/rtems/posix/rwlockimpl.h

    rc3d8d9e r631b3c8  
    8888
    8989POSIX_RWLock_Control *_POSIX_RWLock_Get(
    90   pthread_rwlock_t *rwlock,
    91   ISR_lock_Context *lock_context
     90  pthread_rwlock_t     *rwlock,
     91  Thread_queue_Context *queue_context
    9292);
    9393
  • cpukit/posix/include/rtems/posix/semaphoreimpl.h

    rc3d8d9e r631b3c8  
    6262
    6363RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get(
    64   const sem_t       *id,
    65   ISR_lock_Context  *lock_context
     64  const sem_t          *id,
     65  Thread_queue_Context *queue_context
    6666)
    6767{
     68  _Thread_queue_Context_initialize( queue_context, NULL );
    6869  return (POSIX_Semaphore_Control *) _Objects_Get(
    6970    (Objects_Id) *id,
    70     lock_context,
     71    &queue_context->Lock_context,
    7172    &_POSIX_Semaphore_Information
    7273  );
     
    9495void _POSIX_Semaphore_Delete(
    9596  POSIX_Semaphore_Control *the_semaphore,
    96   ISR_lock_Context        *lock_context
     97  Thread_queue_Context    *queue_context
    9798);
    9899
  • cpukit/posix/src/conddestroy.c

    rc3d8d9e r631b3c8  
    3030{
    3131  POSIX_Condition_variables_Control *the_cond;
    32   ISR_lock_Context                   lock_context;
     32  Thread_queue_Context               queue_context;
    3333
    3434  _Objects_Allocator_lock();
    35   the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
     35  the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
    3636
    3737  if ( the_cond == NULL ) {
     
    4040  }
    4141
    42   _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
     42  _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
    4343
    4444  if ( !_Thread_queue_Is_empty( &the_cond->Wait_queue.Queue ) ) {
    45     _POSIX_Condition_variables_Release( the_cond, &lock_context );
     45    _POSIX_Condition_variables_Release( the_cond, &queue_context );
    4646    _Objects_Allocator_unlock();
    4747    return EBUSY;
     
    5252    &the_cond->Object
    5353  );
    54   _POSIX_Condition_variables_Release( the_cond, &lock_context );
     54  _POSIX_Condition_variables_Release( the_cond, &queue_context );
    5555  _POSIX_Condition_variables_Destroy( the_cond );
    5656  _POSIX_Condition_variables_Free( the_cond );
  • cpukit/posix/src/condget.c

    rc3d8d9e r631b3c8  
    1616
    1717POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get(
    18   pthread_cond_t   *cond,
    19   ISR_lock_Context *lock_context
     18  pthread_cond_t       *cond,
     19  Thread_queue_Context *queue_context
    2020)
    2121{
     
    2323    POSIX_Condition_variables_Control,
    2424    cond,
    25     lock_context,
     25    queue_context,
    2626    &_POSIX_Condition_variables_Information,
    2727    PTHREAD_COND_INITIALIZER,
  • cpukit/posix/src/condsignalsupp.c

    rc3d8d9e r631b3c8  
    3737  do {
    3838    POSIX_Condition_variables_Control *the_cond;
    39     ISR_lock_Context                   lock_context;
     39    Thread_queue_Context               queue_context;
    4040
    41     the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
     41    the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
    4242
    4343    if ( the_cond == NULL ) {
     
    4545    }
    4646
    47     _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
     47    _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
    4848
    4949    the_thread = _Thread_queue_First_locked(
     
    5757        POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
    5858        the_thread,
    59         NULL,
    60         &lock_context
     59        &queue_context
    6160      );
    6261    } else {
    6362      the_cond->mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
    64       _POSIX_Condition_variables_Release( the_cond, &lock_context );
     63      _POSIX_Condition_variables_Release( the_cond, &queue_context );
    6564    }
    6665  } while ( is_broadcast && the_thread != NULL );
  • cpukit/posix/src/condwaitsupp.c

    rc3d8d9e r631b3c8  
    3636  POSIX_Condition_variables_Control *the_cond;
    3737  POSIX_Mutex_Control               *the_mutex;
    38   ISR_lock_Context                   lock_context;
     38  Thread_queue_Context               queue_context;
    3939  int                                status;
    4040  int                                mutex_status;
     
    4747  }
    4848
    49   the_cond = _POSIX_Condition_variables_Get( cond, &lock_context );
     49  the_cond = _POSIX_Condition_variables_Get( cond, &queue_context );
    5050
    5151  if ( the_cond == NULL ) {
     
    5353  }
    5454
    55   _POSIX_Condition_variables_Acquire_critical( the_cond, &lock_context );
     55  _POSIX_Condition_variables_Acquire_critical( the_cond, &queue_context );
    5656
    5757  if (
     
    5959      && the_cond->mutex != *mutex
    6060  ) {
    61     _POSIX_Condition_variables_Release( the_cond, &lock_context );
     61    _POSIX_Condition_variables_Release( the_cond, &queue_context );
    6262    return EINVAL;
    6363  }
     
    6565  the_cond->mutex = *mutex;
    6666
    67   cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
     67  cpu_self = _Thread_Dispatch_disable_critical( &queue_context.Lock_context );
    6868  executing = _Per_CPU_Get_executing( cpu_self );
    6969
     
    7979      || !_CORE_mutex_Is_owner( &the_mutex->Mutex, executing )
    8080  ) {
    81     _POSIX_Condition_variables_Release( the_cond, &lock_context );
     81    _POSIX_Condition_variables_Release( the_cond, &queue_context );
    8282    _Thread_Dispatch_enable( cpu_self );
    8383    return EPERM;
     
    9393      timeout,
    9494      ETIMEDOUT,
    95       &lock_context
     95      &queue_context.Lock_context
    9696    );
    9797  } else {
    98     _POSIX_Condition_variables_Release( the_cond, &lock_context );
     98    _POSIX_Condition_variables_Release( the_cond, &queue_context );
    9999    executing->Wait.return_code = ETIMEDOUT;
    100100  }
    101101
    102   _ISR_lock_ISR_disable( &lock_context );
     102  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    103103  core_mutex_status = _CORE_mutex_Surrender(
    104104    &the_mutex->Mutex,
    105     NULL,
    106     &lock_context
     105    &queue_context
    107106  );
    108107  _Assert( core_mutex_status == CORE_MUTEX_STATUS_SUCCESSFUL );
  • cpukit/posix/src/mqueueclose.c

    rc3d8d9e r631b3c8  
    4343{
    4444  POSIX_Message_queue_Control *the_mq;
    45   ISR_lock_Context             lock_context;
     45  Thread_queue_Context         queue_context;
    4646
    4747  _Objects_Allocator_lock();
    48   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     48  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    4949
    5050  if ( the_mq == NULL ) {
     
    5555  _CORE_message_queue_Acquire_critical(
    5656    &the_mq->Message_queue,
    57     &lock_context
     57    &queue_context
    5858  );
    5959
    6060  if ( the_mq->open_count == 0 ) {
    61     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     61    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    6262    _Objects_Allocator_unlock();
    6363    rtems_set_errno_and_return_minus_one( EBADF );
     
    6565
    6666  the_mq->open_count -= 1;
    67   _POSIX_Message_queue_Delete( the_mq, &lock_context );
     67  _POSIX_Message_queue_Delete( the_mq, &queue_context );
    6868
    6969  _Objects_Allocator_unlock();
  • cpukit/posix/src/mqueuedeletesupp.c

    rc3d8d9e r631b3c8  
    2323void _POSIX_Message_queue_Delete(
    2424  POSIX_Message_queue_Control *the_mq,
    25   ISR_lock_Context            *lock_context
     25  Thread_queue_Context        *queue_context
    2626)
    2727{
    2828  if ( !the_mq->linked && the_mq->open_count == 0 ) {
    29     _CORE_message_queue_Close(
    30       &the_mq->Message_queue,
    31       NULL,        /* no MP support */
    32       lock_context
    33     );
     29    _CORE_message_queue_Close( &the_mq->Message_queue, queue_context );
    3430    _POSIX_Message_queue_Free( the_mq );
    3531  } else {
    36     _CORE_message_queue_Release( &the_mq->Message_queue, lock_context );
     32    _CORE_message_queue_Release( &the_mq->Message_queue, queue_context );
    3733  }
    3834}
  • cpukit/posix/src/mqueuegetattr.c

    rc3d8d9e r631b3c8  
    4343{
    4444  POSIX_Message_queue_Control *the_mq;
    45   ISR_lock_Context             lock_context;
     45  Thread_queue_Context         queue_context;
    4646
    4747  if ( mqstat == NULL ) {
     
    4949  }
    5050
    51   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     51  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    5252
    5353  if ( the_mq == NULL ) {
     
    5757  _CORE_message_queue_Acquire_critical(
    5858    &the_mq->Message_queue,
    59     &lock_context
     59    &queue_context
    6060  );
    6161
    6262  if ( the_mq->open_count == 0 ) {
    63     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     63    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    6464    rtems_set_errno_and_return_minus_one( EBADF );
    6565  }
     
    7373  mqstat->mq_curmsgs = the_mq->Message_queue.number_of_pending_messages;
    7474
    75   _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     75  _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    7676  return 0;
    7777}
  • cpukit/posix/src/mqueuenotify.c

    rc3d8d9e r631b3c8  
    2525static void _POSIX_Message_queue_Notify_handler(
    2626  CORE_message_queue_Control *the_message_queue,
    27   ISR_lock_Context           *lock_context
     27  Thread_queue_Context       *queue_context
    2828)
    2929{
     
    3939  signo = the_mq->notification.sigev_signo;
    4040  _CORE_message_queue_Set_notify( &the_mq->Message_queue, NULL );
    41   _CORE_message_queue_Release( &the_mq->Message_queue, lock_context );
     41  _CORE_message_queue_Release( &the_mq->Message_queue, queue_context );
    4242
    4343  kill( getpid(), signo );
     
    5050{
    5151  POSIX_Message_queue_Control *the_mq;
    52   ISR_lock_Context             lock_context;
     52  Thread_queue_Context         queue_context;
    5353
    54   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     54  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    5555
    5656  if ( the_mq == NULL ) {
     
    6060  _CORE_message_queue_Acquire_critical(
    6161    &the_mq->Message_queue,
    62     &lock_context
     62    &queue_context
    6363  );
    6464
    6565  if ( the_mq->open_count == 0 ) {
    66     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     66    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    6767    rtems_set_errno_and_return_minus_one( EBADF );
    6868  }
     
    7070  if ( notification != NULL ) {
    7171    if ( _CORE_message_queue_Is_notify_enabled( &the_mq->Message_queue ) ) {
    72       _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     72      _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    7373      rtems_set_errno_and_return_minus_one( EBUSY );
    7474    }
     
    8484  }
    8585
    86   _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     86  _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    8787  return 0;
    8888}
  • cpukit/posix/src/mqueuerecvsupp.c

    rc3d8d9e r631b3c8  
    4545{
    4646  POSIX_Message_queue_Control *the_mq;
    47   ISR_lock_Context             lock_context;
     47  Thread_queue_Context         queue_context;
    4848  size_t                       length_out;
    4949  bool                         do_wait;
    5050  Thread_Control              *executing;
    5151
    52   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     52  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    5353
    5454  if ( the_mq == NULL ) {
     
    5757
    5858  if ( ( the_mq->oflag & O_ACCMODE ) == O_WRONLY ) {
    59     _ISR_lock_ISR_enable( &lock_context );
     59    _ISR_lock_ISR_enable( &queue_context.Lock_context );
    6060    rtems_set_errno_and_return_minus_one( EBADF );
    6161  }
    6262
    6363  if ( msg_len < the_mq->Message_queue.maximum_message_size ) {
    64     _ISR_lock_ISR_enable( &lock_context );
     64    _ISR_lock_ISR_enable( &queue_context.Lock_context );
    6565    rtems_set_errno_and_return_minus_one( EMSGSIZE );
    6666  }
     
    8484  _CORE_message_queue_Acquire_critical(
    8585    &the_mq->Message_queue,
    86     &lock_context
     86    &queue_context
    8787  );
    8888
    8989  if ( the_mq->open_count == 0 ) {
    90     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     90    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    9191    rtems_set_errno_and_return_minus_one( EBADF );
    9292  }
     
    103103    do_wait,
    104104    timeout,
    105     &lock_context
     105    &queue_context
    106106  );
    107107
  • cpukit/posix/src/mqueuesendsupp.c

    rc3d8d9e r631b3c8  
    4545{
    4646  POSIX_Message_queue_Control *the_mq;
    47   ISR_lock_Context             lock_context;
     47  Thread_queue_Context         queue_context;
    4848  CORE_message_queue_Status    msg_status;
    4949  bool                         do_wait;
     
    5959  }
    6060
    61   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     61  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    6262
    6363  if ( the_mq == NULL ) {
     
    6666
    6767  if ( ( the_mq->oflag & O_ACCMODE ) == O_RDONLY ) {
    68     _ISR_lock_ISR_enable( &lock_context );
     68    _ISR_lock_ISR_enable( &queue_context.Lock_context );
    6969    rtems_set_errno_and_return_minus_one( EBADF );
    7070  }
     
    8181  _CORE_message_queue_Acquire_critical(
    8282    &the_mq->Message_queue,
    83     &lock_context
     83    &queue_context
    8484  );
    8585
    8686  if ( the_mq->open_count == 0 ) {
    87     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     87    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    8888    rtems_set_errno_and_return_minus_one( EBADF );
    8989  }
     
    9898    msg_ptr,
    9999    msg_len,
    100     NULL,
    101100    _POSIX_Message_queue_Priority_to_core( msg_prio ),
    102101    do_wait,
    103102    timeout,
    104     &lock_context
     103    &queue_context
    105104  );
    106105
  • cpukit/posix/src/mqueuesetattr.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_Message_queue_Control *the_mq;
    30   ISR_lock_Context             lock_context;
     30  Thread_queue_Context         queue_context;
    3131
    3232  if ( mqstat == NULL ) {
     
    3434  }
    3535
    36   the_mq = _POSIX_Message_queue_Get( mqdes, &lock_context );
     36  the_mq = _POSIX_Message_queue_Get( mqdes, &queue_context );
    3737
    3838  if ( the_mq == NULL ) {
     
    4242  _CORE_message_queue_Acquire_critical(
    4343    &the_mq->Message_queue,
    44     &lock_context
     44    &queue_context
    4545  );
    4646
    4747  if ( the_mq->open_count == 0 ) {
    48     _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     48    _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    4949    rtems_set_errno_and_return_minus_one( EBADF );
    5050  }
     
    6363  the_mq->oflag = mqstat->mq_flags;
    6464
    65   _CORE_message_queue_Release( &the_mq->Message_queue, &lock_context );
     65  _CORE_message_queue_Release( &the_mq->Message_queue, &queue_context );
    6666  return 0;
    6767}
  • cpukit/posix/src/mqueueunlink.c

    rc3d8d9e r631b3c8  
    3131  POSIX_Message_queue_Control *the_mq;
    3232  Objects_Get_by_name_error    error;
    33   ISR_lock_Context             lock_context;
     33  Thread_queue_Context         queue_context;
    3434
    3535  _Objects_Allocator_lock();
     
    4343  _POSIX_Message_queue_Namespace_remove( the_mq );
    4444
    45   _CORE_message_queue_Acquire( &the_mq->Message_queue, &lock_context );
     45  _CORE_message_queue_Acquire( &the_mq->Message_queue, &queue_context );
    4646
    4747  the_mq->linked = false;
    48   _POSIX_Message_queue_Delete( the_mq, &lock_context );
     48  _POSIX_Message_queue_Delete( the_mq, &queue_context );
    4949
    5050  _Objects_Allocator_unlock();
  • cpukit/posix/src/mutexdestroy.c

    rc3d8d9e r631b3c8  
    2929)
    3030{
    31   POSIX_Mutex_Control *the_mutex;
    32   ISR_lock_Context     lock_context;
    33   int                  eno;
     31  POSIX_Mutex_Control  *the_mutex;
     32  Thread_queue_Context  queue_context;
     33  int                   eno;
    3434
    3535  _Objects_Allocator_lock();
    3636
    37   the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
     37  the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
    3838
    3939  if ( the_mutex != NULL ) {
    40     _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
     40    _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &queue_context );
    4141
    4242    /*
     
    4747    if ( !_CORE_mutex_Is_locked( &the_mutex->Mutex ) ) {
    4848      _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object );
    49       _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
     49      _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
    5050      _CORE_mutex_Destroy( &the_mutex->Mutex );
    5151      _POSIX_Mutex_Free( the_mutex );
    5252      eno = 0;
    5353    } else {
    54       _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
     54      _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
    5555      eno = EBUSY;
    5656    }
  • cpukit/posix/src/mutexget.c

    rc3d8d9e r631b3c8  
    2323
    2424POSIX_Mutex_Control *_POSIX_Mutex_Get(
    25   pthread_mutex_t  *mutex,
    26   ISR_lock_Context *lock_context
     25  pthread_mutex_t      *mutex,
     26  Thread_queue_Context *queue_context
    2727)
    2828{
     
    3030    POSIX_Mutex_Control,
    3131    mutex,
    32     lock_context,
     32    queue_context,
    3333    &_POSIX_Mutex_Information,
    3434    PTHREAD_MUTEX_INITIALIZER,
  • cpukit/posix/src/mutexgetprioceiling.c

    rc3d8d9e r631b3c8  
    3131)
    3232{
    33   POSIX_Mutex_Control *the_mutex;
    34   ISR_lock_Context     lock_context;
     33  POSIX_Mutex_Control  *the_mutex;
     34  Thread_queue_Context  queue_context;
    3535
    3636  if ( prioceiling == NULL ) {
     
    3838  }
    3939
    40   the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
     40  the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
    4141
    4242  if ( the_mutex == NULL ) {
     
    4444  }
    4545
    46   _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &lock_context );
     46  _CORE_mutex_Acquire_critical( &the_mutex->Mutex, &queue_context );
    4747
    4848  *prioceiling = _POSIX_Priority_From_core(
     
    5050  );
    5151
    52   _CORE_mutex_Release( &the_mutex->Mutex, &lock_context );
     52  _CORE_mutex_Release( &the_mutex->Mutex, &queue_context );
    5353
    5454  return 0;
  • cpukit/posix/src/mutexlocksupp.c

    rc3d8d9e r631b3c8  
    2929)
    3030{
    31   POSIX_Mutex_Control *the_mutex;
    32   ISR_lock_Context     lock_context;
    33   Thread_Control      *executing;
     31  POSIX_Mutex_Control  *the_mutex;
     32  Thread_queue_Context  queue_context;
     33  Thread_Control       *executing;
    3434
    35   the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
     35  the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
    3636
    3737  if ( the_mutex == NULL ) {
     
    4545    blocking,
    4646    timeout,
    47     &lock_context
     47    &queue_context
    4848  );
    4949  return _POSIX_Mutex_Translate_core_mutex_return_code(
  • cpukit/posix/src/mutexsetprioceiling.c

    rc3d8d9e r631b3c8  
    3434  register POSIX_Mutex_Control *the_mutex;
    3535  Priority_Control              the_priority;
    36   ISR_lock_Context              lock_context;
     36  Thread_queue_Context          queue_context;
    3737
    3838  if ( !old_ceiling )
     
    5858   *        bad Id case is handled by the switch.
    5959   */
    60   the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
     60  the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
    6161
    6262  if ( the_mutex == NULL ) {
     
    7474  _CORE_mutex_Surrender(
    7575    &the_mutex->Mutex,
    76     NULL,
    77     &lock_context
     76    &queue_context
    7877  );
    7978  return 0;
  • cpukit/posix/src/mutexunlock.c

    rc3d8d9e r631b3c8  
    3131)
    3232{
    33   POSIX_Mutex_Control *the_mutex;
    34   CORE_mutex_Status    status;
    35   ISR_lock_Context     lock_context;
     33  POSIX_Mutex_Control  *the_mutex;
     34  CORE_mutex_Status     status;
     35  Thread_queue_Context  queue_context;
    3636
    37   the_mutex = _POSIX_Mutex_Get( mutex, &lock_context );
     37  the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
    3838
    3939  if ( the_mutex == NULL ) {
     
    4141  }
    4242
    43   status = _CORE_mutex_Surrender(
    44     &the_mutex->Mutex,
    45     NULL,
    46     &lock_context
    47   );
     43  status = _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
    4844  return _POSIX_Mutex_Translate_core_mutex_return_code( status );
    4945}
  • cpukit/posix/src/pbarrierdestroy.c

    rc3d8d9e r631b3c8  
    3737{
    3838  POSIX_Barrier_Control *the_barrier;
    39   ISR_lock_Context       lock_context;
     39  Thread_queue_Context   queue_context;
    4040
    4141  if ( barrier == NULL ) {
     
    4444
    4545  _Objects_Allocator_lock();
    46   the_barrier = _POSIX_Barrier_Get( barrier, &lock_context );
     46  the_barrier = _POSIX_Barrier_Get( barrier, &queue_context );
    4747
    4848  if ( the_barrier == NULL ) {
     
    5151  }
    5252
    53   _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
     53  _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &queue_context );
    5454
    5555  if ( the_barrier->Barrier.number_of_waiting_threads != 0 ) {
    56     _CORE_barrier_Release( &the_barrier->Barrier, &lock_context );
     56    _CORE_barrier_Release( &the_barrier->Barrier, &queue_context );
    5757    _Objects_Allocator_unlock();
    5858    return EBUSY;
     
    6060
    6161  _Objects_Close( &_POSIX_Barrier_Information, &the_barrier->Object );
    62   _CORE_barrier_Release( &the_barrier->Barrier, &lock_context );
     62  _CORE_barrier_Release( &the_barrier->Barrier, &queue_context );
    6363  _POSIX_Barrier_Free( the_barrier );
    6464  _Objects_Allocator_unlock();
  • cpukit/posix/src/pbarrierwait.c

    rc3d8d9e r631b3c8  
    3838{
    3939  POSIX_Barrier_Control *the_barrier;
    40   ISR_lock_Context       lock_context;
     40  Thread_queue_Context   queue_context;
    4141  Thread_Control        *executing;
    4242
     
    4545  }
    4646
    47   the_barrier = _POSIX_Barrier_Get( barrier, &lock_context );
     47  the_barrier = _POSIX_Barrier_Get( barrier, &queue_context );
    4848
    4949  if ( the_barrier == NULL ) {
     
    5757    true,
    5858    0,
    59     NULL,
    60     &lock_context
     59    &queue_context
    6160  );
    6261  return _POSIX_Barrier_Translate_core_barrier_return_code(
  • cpukit/posix/src/prwlockdestroy.c

    rc3d8d9e r631b3c8  
    2525{
    2626  POSIX_RWLock_Control *the_rwlock;
    27   ISR_lock_Context      lock_context;
     27  Thread_queue_Context  queue_context;
    2828
    2929  _Objects_Allocator_lock();
    30   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     30  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3131
    3232  if ( the_rwlock == NULL ) {
     
    3535  }
    3636
    37   _CORE_RWLock_Acquire_critical( &the_rwlock->RWLock, &lock_context );
     37  _CORE_RWLock_Acquire_critical( &the_rwlock->RWLock, &queue_context );
    3838
    3939  /*
     
    4242
    4343  if ( !_Thread_queue_Is_empty( &the_rwlock->RWLock.Wait_queue.Queue ) ) {
    44     _CORE_RWLock_Release( &the_rwlock->RWLock, &lock_context );
     44    _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context );
    4545    _Objects_Allocator_unlock();
    4646    return EBUSY;
     
    5252
    5353  _Objects_Close( &_POSIX_RWLock_Information, &the_rwlock->Object );
    54   _CORE_RWLock_Release( &the_rwlock->RWLock, &lock_context );
     54  _CORE_RWLock_Release( &the_rwlock->RWLock, &queue_context );
    5555  _POSIX_RWLock_Free( the_rwlock );
    5656  _Objects_Allocator_unlock();
  • cpukit/posix/src/prwlockinit.c

    rc3d8d9e r631b3c8  
    2525
    2626POSIX_RWLock_Control *_POSIX_RWLock_Get(
    27   pthread_rwlock_t *rwlock,
    28   ISR_lock_Context *lock_context
     27  pthread_rwlock_t     *rwlock,
     28  Thread_queue_Context *queue_context
    2929)
    3030{
     
    3232    POSIX_RWLock_Control,
    3333    rwlock,
    34     lock_context,
     34    queue_context,
    3535    &_POSIX_RWLock_Information,
    3636    PTHREAD_RWLOCK_INITIALIZER,
  • cpukit/posix/src/prwlockrdlock.c

    rc3d8d9e r631b3c8  
    2626{
    2727  POSIX_RWLock_Control *the_rwlock;
    28   ISR_lock_Context      lock_context;
     28  Thread_queue_Context  queue_context;
    2929  Thread_Control       *executing;
    3030
    31   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     31  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3232
    3333  if ( the_rwlock == NULL ) {
     
    4141    true,                 /* we are willing to wait forever */
    4242    0,
    43     &lock_context
     43    &queue_context
    4444  );
    4545  return _POSIX_RWLock_Translate_core_RWLock_return_code(
  • cpukit/posix/src/prwlocktimedrdlock.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_RWLock_Control                    *the_rwlock;
    30   ISR_lock_Context                         lock_context;
     30  Thread_queue_Context                     queue_context;
    3131  Watchdog_Interval                        ticks;
    3232  bool                                     do_wait;
     
    5050  do_wait = ( status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
    5151
    52   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     52  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    5353
    5454  if ( the_rwlock == NULL ) {
     
    6262    do_wait,
    6363    ticks,
    64     &lock_context
     64    &queue_context
    6565  );
    6666
  • cpukit/posix/src/prwlocktimedwrlock.c

    rc3d8d9e r631b3c8  
    3030{
    3131  POSIX_RWLock_Control                    *the_rwlock;
    32   ISR_lock_Context                         lock_context;
     32  Thread_queue_Context                     queue_context;
    3333  Watchdog_Interval                        ticks;
    3434  bool                                     do_wait;
     
    5252  do_wait = ( status == TOD_ABSOLUTE_TIMEOUT_IS_IN_FUTURE );
    5353
    54   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     54  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    5555
    5656  if ( the_rwlock == NULL ) {
     
    6464    do_wait,
    6565    ticks,
    66     &lock_context
     66    &queue_context
    6767  );
    6868
  • cpukit/posix/src/prwlocktryrdlock.c

    rc3d8d9e r631b3c8  
    2626{
    2727  POSIX_RWLock_Control *the_rwlock;
    28   ISR_lock_Context      lock_context;
     28  Thread_queue_Context  queue_context;
    2929  Thread_Control       *executing;
    3030
    31   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     31  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3232
    3333  if ( the_rwlock == NULL ) {
     
    4141    false,                  /* do not wait for the rwlock */
    4242    0,
    43     &lock_context
     43    &queue_context
    4444  );
    4545  return _POSIX_RWLock_Translate_core_RWLock_return_code(
  • cpukit/posix/src/prwlocktrywrlock.c

    rc3d8d9e r631b3c8  
    2626{
    2727  POSIX_RWLock_Control *the_rwlock;
    28   ISR_lock_Context      lock_context;
     28  Thread_queue_Context  queue_context;
    2929  Thread_Control       *executing;
    3030
    31   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     31  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3232
    3333  if ( the_rwlock == NULL ) {
     
    4141    false,                 /* we are not willing to wait */
    4242    0,
    43     &lock_context
     43    &queue_context
    4444  );
    4545  return _POSIX_RWLock_Translate_core_RWLock_return_code(
  • cpukit/posix/src/prwlockunlock.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_RWLock_Control *the_rwlock;
    30   ISR_lock_Context      lock_context;
     30  Thread_queue_Context  queue_context;
    3131  CORE_RWLock_Status    status;
    3232
    33   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     33  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3434
    3535  if ( the_rwlock == NULL ) {
     
    3737  }
    3838
    39   status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, &lock_context );
     39  status = _CORE_RWLock_Surrender( &the_rwlock->RWLock, &queue_context );
    4040  return _POSIX_RWLock_Translate_core_RWLock_return_code( status );
    4141}
  • cpukit/posix/src/prwlockwrlock.c

    rc3d8d9e r631b3c8  
    3333{
    3434  POSIX_RWLock_Control *the_rwlock;
    35   ISR_lock_Context      lock_context;
     35  Thread_queue_Context  queue_context;
    3636  Thread_Control       *executing;
    3737
    38   the_rwlock = _POSIX_RWLock_Get( rwlock, &lock_context );
     38  the_rwlock = _POSIX_RWLock_Get( rwlock, &queue_context );
    3939
    4040  if ( the_rwlock == NULL ) {
     
    4848    true,          /* do not timeout -- wait forever */
    4949    0,
    50     &lock_context
     50    &queue_context
    5151  );
    5252  return _POSIX_RWLock_Translate_core_RWLock_return_code(
  • cpukit/posix/src/semaphoredeletesupp.c

    rc3d8d9e r631b3c8  
    2323void _POSIX_Semaphore_Delete(
    2424  POSIX_Semaphore_Control *the_semaphore,
    25   ISR_lock_Context        *lock_context
     25  Thread_queue_Context    *queue_context
    2626)
    2727{
    2828  if ( !the_semaphore->linked && !the_semaphore->open_count ) {
    2929    _Objects_Close( &_POSIX_Semaphore_Information, &the_semaphore->Object );
    30     _CORE_semaphore_Destroy(
    31       &the_semaphore->Semaphore,
    32       NULL,
    33       lock_context
    34     );
     30    _CORE_semaphore_Destroy( &the_semaphore->Semaphore, queue_context );
    3531    _POSIX_Semaphore_Free( the_semaphore );
    3632  } else {
    37     _CORE_semaphore_Release( &the_semaphore->Semaphore, lock_context );
     33    _CORE_semaphore_Release( &the_semaphore->Semaphore, queue_context );
    3834  }
    3935}
  • cpukit/posix/src/semaphorewaitsupp.c

    rc3d8d9e r631b3c8  
    3333  POSIX_Semaphore_Control *the_semaphore;
    3434  Thread_Control          *executing;
    35   ISR_lock_Context         lock_context;
     35  Thread_queue_Context     queue_context;
    3636
    37   the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
     37  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
    3838
    3939  if ( the_semaphore == NULL ) {
     
    4848    blocking,
    4949    timeout,
    50     &lock_context
     50    &queue_context
    5151  );
    5252
  • cpukit/posix/src/semclose.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_Semaphore_Control *the_semaphore;
    30   ISR_lock_Context         lock_context;
     30  Thread_queue_Context     queue_context;
    3131
    3232  _Objects_Allocator_lock();
    33   the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
     33  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
    3434
    3535  if ( the_semaphore == NULL ) {
     
    4040  _CORE_semaphore_Acquire_critical(
    4141    &the_semaphore->Semaphore,
    42     &lock_context
     42    &queue_context
    4343  );
    4444  the_semaphore->open_count -= 1;
    45   _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
     45  _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
    4646
    4747  _Objects_Allocator_unlock();
  • cpukit/posix/src/semdestroy.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_Semaphore_Control *the_semaphore;
    30   ISR_lock_Context         lock_context;
     30  Thread_queue_Context     queue_context;
    3131
    3232  _Objects_Allocator_lock();
    33   the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
     33  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
    3434
    3535  if ( the_semaphore == NULL ) {
     
    4040  _CORE_semaphore_Acquire_critical(
    4141    &the_semaphore->Semaphore,
    42     &lock_context
     42    &queue_context
    4343  );
    4444
    4545  if ( the_semaphore->named ) {
    4646    /* Undefined operation on a named semaphore */
    47     _CORE_semaphore_Release( &the_semaphore->Semaphore, &lock_context );
     47    _CORE_semaphore_Release( &the_semaphore->Semaphore, &queue_context );
    4848    _Objects_Allocator_unlock();
    4949    rtems_set_errno_and_return_minus_one( EINVAL );
    5050  }
    5151
    52   _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
     52  _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
    5353
    5454  _Objects_Allocator_unlock();
  • cpukit/posix/src/semgetvalue.c

    rc3d8d9e r631b3c8  
    2929{
    3030  POSIX_Semaphore_Control *the_semaphore;
    31   ISR_lock_Context         lock_context;
     31  Thread_queue_Context     queue_context;
    3232
    33   the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
     33  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
    3434
    3535  if ( the_semaphore == NULL ) {
     
    3737  }
    3838
    39   /*
    40    * Assume a relaxed atomic load of the value on SMP configurations.
    41    * Thus, there is no need to acquire a lock.
    42    */
     39  _CORE_semaphore_Acquire_critical(
     40    &the_semaphore->Semaphore,
     41    &queue_context
     42  );
     43
    4344  *sval = _CORE_semaphore_Get_count( &the_semaphore->Semaphore );
    4445
    45   _ISR_lock_ISR_enable( &lock_context );
     46  _CORE_semaphore_Release( &the_semaphore->Semaphore, &queue_context );
    4647  return 0;
    4748}
  • cpukit/posix/src/sempost.c

    rc3d8d9e r631b3c8  
    2828{
    2929  POSIX_Semaphore_Control *the_semaphore;
    30   ISR_lock_Context         lock_context;
     30  Thread_queue_Context     queue_context;
    3131
    32   the_semaphore = _POSIX_Semaphore_Get( sem, &lock_context );
     32  the_semaphore = _POSIX_Semaphore_Get( sem, &queue_context );
    3333
    3434  if ( the_semaphore == NULL ) {
     
    3838  _CORE_semaphore_Surrender(
    3939    &the_semaphore->Semaphore,
    40     NULL,
    41     &lock_context
     40    &queue_context
    4241  );
    4342  return 0;
  • cpukit/posix/src/semunlink.c

    rc3d8d9e r631b3c8  
    2929  POSIX_Semaphore_Control   *the_semaphore;
    3030  Objects_Get_by_name_error  error;
    31   ISR_lock_Context           lock_context;
     31  Thread_queue_Context       queue_context;
    3232
    3333  _Objects_Allocator_lock();
     
    4141  _POSIX_Semaphore_Namespace_remove( the_semaphore );
    4242
    43   _ISR_lock_ISR_disable( &lock_context );
    44   _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &lock_context );
     43  _ISR_lock_ISR_disable( &queue_context.Lock_context );
     44  _CORE_semaphore_Acquire_critical( &the_semaphore->Semaphore, &queue_context );
    4545  the_semaphore->linked = false;
    46   _POSIX_Semaphore_Delete( the_semaphore, &lock_context );
     46  _POSIX_Semaphore_Delete( the_semaphore, &queue_context );
    4747
    4848  _Objects_Allocator_unlock();
  • cpukit/rtems/include/rtems/rtems/barrierimpl.h

    rc3d8d9e r631b3c8  
    7171
    7272RTEMS_INLINE_ROUTINE Barrier_Control *_Barrier_Get(
    73   Objects_Id        id,
    74   ISR_lock_Context *lock_context
     73  Objects_Id            id,
     74  Thread_queue_Context *queue_context
    7575)
    7676{
     77  _Thread_queue_Context_initialize( queue_context, NULL );
    7778  return (Barrier_Control *)
    78     _Objects_Get( id, lock_context, &_Barrier_Information );
     79    _Objects_Get( id, &queue_context->Lock_context, &_Barrier_Information );
    7980}
    8081
  • cpukit/rtems/include/rtems/rtems/messageimpl.h

    rc3d8d9e r631b3c8  
    102102}
    103103
    104 RTEMS_INLINE_ROUTINE Message_queue_Control * _Message_queue_Get(
    105   Objects_Id         id,
    106   ISR_lock_Context  *lock_context
     104RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Do_get(
     105  Objects_Id               id,
     106  Thread_queue_Context    *queue_context
     107#if defined(RTEMS_MULTIPROCESSING)
     108  ,
     109  Thread_queue_MP_callout  mp_callout
     110#endif
    107111)
    108112{
     113  _Thread_queue_Context_initialize( queue_context, mp_callout );
    109114  return (Message_queue_Control *) _Objects_Get(
    110115    id,
    111     lock_context,
     116    &queue_context->Lock_context,
    112117    &_Message_queue_Information
    113118  );
    114119}
     120
     121#if defined(RTEMS_MULTIPROCESSING)
     122  #define _Message_queue_Get( id, queue_context, mp_callout ) \
     123    _Message_queue_Do_get( id, queue_context, mp_callout )
     124#else
     125  #define _Message_queue_Get( id, queue_context, mp_callout ) \
     126    _Message_queue_Do_get( id, queue_context )
     127#endif
    115128
    116129RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Allocate( void )
  • cpukit/rtems/include/rtems/rtems/semimpl.h

    rc3d8d9e r631b3c8  
    135135}
    136136
    137 RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get(
    138   Objects_Id         id,
    139   ISR_lock_Context  *lock_context
     137RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Do_get(
     138  Objects_Id               id,
     139  Thread_queue_Context    *queue_context
     140#if defined(RTEMS_MULTIPROCESSING)
     141  ,
     142  Thread_queue_MP_callout  mp_callout
     143#endif
    140144)
    141145{
     146  _Thread_queue_Context_initialize( queue_context, mp_callout );
    142147  return (Semaphore_Control *) _Objects_Get(
    143148    id,
    144     lock_context,
     149    &queue_context->Lock_context,
    145150    &_Semaphore_Information
    146151  );
    147152}
     153
     154#if defined(RTEMS_MULTIPROCESSING)
     155  #define _Semaphore_Get( id, queue_context, mp_callout ) \
     156    _Semaphore_Do_get( id, queue_context, mp_callout )
     157#else
     158  #define _Semaphore_Get( id, queue_context, mp_callout ) \
     159    _Semaphore_Do_get( id, queue_context )
     160#endif
    148161
    149162#ifdef __cplusplus
  • cpukit/rtems/src/barrierdelete.c

    rc3d8d9e r631b3c8  
    2525)
    2626{
    27   Barrier_Control  *the_barrier;
    28   ISR_lock_Context  lock_context;
     27  Barrier_Control      *the_barrier;
     28  Thread_queue_Context  queue_context;
    2929
    3030  _Objects_Allocator_lock();
    31   the_barrier = _Barrier_Get( id, &lock_context );
     31  the_barrier = _Barrier_Get( id, &queue_context );
    3232
    3333  if ( the_barrier == NULL ) {
     
    3636  }
    3737
    38   _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
     38  _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &queue_context );
    3939  _Objects_Close( &_Barrier_Information, &the_barrier->Object );
    40   _CORE_barrier_Flush( &the_barrier->Barrier, NULL, &lock_context );
     40  _CORE_barrier_Flush( &the_barrier->Barrier, &queue_context );
    4141  _Barrier_Free( the_barrier );
    4242  _Objects_Allocator_unlock();
  • cpukit/rtems/src/barrierrelease.c

    rc3d8d9e r631b3c8  
    2626)
    2727{
    28   Barrier_Control  *the_barrier;
    29   ISR_lock_Context  lock_context;
     28  Barrier_Control      *the_barrier;
     29  Thread_queue_Context  queue_context;
    3030
    3131  if ( released == NULL ) {
     
    3333  }
    3434
    35   the_barrier = _Barrier_Get( id, &lock_context );
     35  the_barrier = _Barrier_Get( id, &queue_context );
    3636
    3737  if ( the_barrier == NULL ) {
     
    3939  }
    4040
    41   _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &lock_context );
     41  _CORE_barrier_Acquire_critical( &the_barrier->Barrier, &queue_context );
    4242  *released = _CORE_barrier_Surrender(
    4343    &the_barrier->Barrier,
    44     NULL,
    45     &lock_context
     44    &queue_context
    4645  );
    4746  return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/barrierwait.c

    rc3d8d9e r631b3c8  
    2828)
    2929{
    30   Barrier_Control  *the_barrier;
    31   ISR_lock_Context  lock_context;
    32   Thread_Control   *executing;
     30  Barrier_Control      *the_barrier;
     31  Thread_queue_Context  queue_context;
     32  Thread_Control       *executing;
    3333
    34   the_barrier = _Barrier_Get( id, &lock_context );
     34  the_barrier = _Barrier_Get( id, &queue_context );
    3535
    3636  if ( the_barrier == NULL ) {
     
    4444    true,
    4545    timeout,
    46     NULL,
    47     &lock_context
     46    &queue_context
    4847  );
    4948  return _Barrier_Translate_core_barrier_return_code(
  • cpukit/rtems/src/msgmp.c

    rc3d8d9e r631b3c8  
    577577}
    578578
    579 /*
    580  *  _Message_queue_Core_message_queue_mp_support
    581  *
    582  *  Input parameters:
    583  *    the_thread - the remote thread the message was submitted to
    584  *    id         - id of the message queue
    585  *
    586  *  Output parameters: NONE
    587  */
    588 
    589 void  _Message_queue_Core_message_queue_mp_support (
     579void  _Message_queue_Core_message_queue_mp_support(
    590580  Thread_Control *the_thread,
    591581  Objects_Id      id
  • cpukit/rtems/src/msgqbroadcast.c

    rc3d8d9e r631b3c8  
    2929{
    3030  Message_queue_Control     *the_message_queue;
    31   ISR_lock_Context           lock_context;
     31  Thread_queue_Context       queue_context;
    3232  CORE_message_queue_Status  status;
    3333
     
    4040  }
    4141
    42   the_message_queue = _Message_queue_Get( id, &lock_context );
     42  the_message_queue = _Message_queue_Get(
     43    id,
     44    &queue_context,
     45    _Message_queue_Core_message_queue_mp_support
     46  );
    4347
    4448  if ( the_message_queue == NULL ) {
     
    5458    buffer,
    5559    size,
    56     _Message_queue_Core_message_queue_mp_support,
    5760    count,
    58     &lock_context
     61    &queue_context
    5962  );
    6063  return _Message_queue_Translate_core_message_queue_return_code( status );
  • cpukit/rtems/src/msgqdelete.c

    rc3d8d9e r631b3c8  
    2727{
    2828  Message_queue_Control *the_message_queue;
    29   ISR_lock_Context       lock_context;
     29  Thread_queue_Context   queue_context;
    3030
    3131  _Objects_Allocator_lock();
    32   the_message_queue = _Message_queue_Get( id, &lock_context );
     32  the_message_queue = _Message_queue_Get(
     33    id,
     34    &queue_context,
     35    _Message_queue_MP_Send_object_was_deleted
     36  );
    3337
    3438  if ( the_message_queue == NULL ) {
     
    4650  _CORE_message_queue_Acquire_critical(
    4751    &the_message_queue->message_queue,
    48     &lock_context
     52    &queue_context
    4953  );
    5054
     
    5357  _CORE_message_queue_Close(
    5458    &the_message_queue->message_queue,
    55     _Message_queue_MP_Send_object_was_deleted,
    56     &lock_context
     59    &queue_context
    5760  );
    5861
  • cpukit/rtems/src/msgqflush.c

    rc3d8d9e r631b3c8  
    2727{
    2828  Message_queue_Control *the_message_queue;
    29   ISR_lock_Context       lock_context;
     29  Thread_queue_Context   queue_context;
    3030
    3131  if ( count == NULL ) {
     
    3333  }
    3434
    35   the_message_queue = _Message_queue_Get( id, &lock_context );
     35  the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
    3636
    3737  if ( the_message_queue == NULL ) {
     
    4545  *count = _CORE_message_queue_Flush(
    4646    &the_message_queue->message_queue,
    47     &lock_context
     47    &queue_context
    4848  );
    4949  return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/msgqgetnumberpending.c

    rc3d8d9e r631b3c8  
    2727{
    2828  Message_queue_Control *the_message_queue;
    29   ISR_lock_Context       lock_context;
     29  Thread_queue_Context   queue_context;
    3030
    3131  if ( count == NULL ) {
     
    3333  }
    3434
    35   the_message_queue = _Message_queue_Get( id, &lock_context );
     35  the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
    3636
    3737  if ( the_message_queue == NULL ) {
     
    4545  _CORE_message_queue_Acquire_critical(
    4646    &the_message_queue->message_queue,
    47     &lock_context
     47    &queue_context
    4848  );
    4949  *count = the_message_queue->message_queue.number_of_pending_messages;
    5050  _CORE_message_queue_Release(
    5151    &the_message_queue->message_queue,
    52     &lock_context
     52    &queue_context
    5353  );
    5454  return RTEMS_SUCCESSFUL;
  • cpukit/rtems/src/msgqreceive.c

    rc3d8d9e r631b3c8  
    3333{
    3434  Message_queue_Control *the_message_queue;
    35   ISR_lock_Context       lock_context;
     35  Thread_queue_Context   queue_context;
    3636  Thread_Control        *executing;
    3737
     
    4444  }
    4545
    46   the_message_queue = _Message_queue_Get( id, &lock_context );
     46  the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
    4747
    4848  if ( the_message_queue == NULL ) {
     
    5656  _CORE_message_queue_Acquire_critical(
    5757    &the_message_queue->message_queue,
    58     &lock_context
     58    &queue_context
    5959  );
    6060
     
    6767    !_Options_Is_no_wait( option_set ),
    6868    timeout,
    69     &lock_context
     69    &queue_context
    7070  );
    7171  return _Message_queue_Translate_core_message_queue_return_code(
  • cpukit/rtems/src/msgqsend.c

    rc3d8d9e r631b3c8  
    2828{
    2929  Message_queue_Control     *the_message_queue;
    30   ISR_lock_Context           lock_context;
     30  Thread_queue_Context       queue_context;
    3131  CORE_message_queue_Status  status;
    3232
     
    3535  }
    3636
    37   the_message_queue = _Message_queue_Get( id, &lock_context );
     37  the_message_queue = _Message_queue_Get(
     38    id,
     39    &queue_context,
     40    _Message_queue_Core_message_queue_mp_support
     41  );
    3842
    3943  if ( the_message_queue == NULL ) {
     
    4751  _CORE_message_queue_Acquire_critical(
    4852    &the_message_queue->message_queue,
    49     &lock_context
     53    &queue_context
    5054  );
    5155  status = _CORE_message_queue_Send(
     
    5357    buffer,
    5458    size,
    55     _Message_queue_Core_message_queue_mp_support,
    5659    false,   /* sender does not block */
    5760    0,       /* no timeout */
    58     &lock_context
     61    &queue_context
    5962  );
    6063
  • cpukit/rtems/src/msgqurgent.c

    rc3d8d9e r631b3c8  
    2828{
    2929  Message_queue_Control     *the_message_queue;
    30   ISR_lock_Context           lock_context;
     30  Thread_queue_Context       queue_context;
    3131  CORE_message_queue_Status  status;
    3232
     
    3535  }
    3636
    37   the_message_queue = _Message_queue_Get( id, &lock_context );
     37  the_message_queue = _Message_queue_Get(
     38    id,
     39    &queue_context,
     40    _Message_queue_Core_message_queue_mp_support
     41  );
    3842
    3943  if ( the_message_queue == NULL ) {
     
    4751  _CORE_message_queue_Acquire_critical(
    4852    &the_message_queue->message_queue,
    49     &lock_context
     53    &queue_context
    5054  );
    5155  status = _CORE_message_queue_Urgent(
     
    5357    buffer,
    5458    size,
    55     _Message_queue_Core_message_queue_mp_support,
    5659    false,   /* sender does not block */
    5760    0,       /* no timeout */
    58     &lock_context
     61    &queue_context
    5962  );
    6063
  • cpukit/rtems/src/semdelete.c

    rc3d8d9e r631b3c8  
    2626)
    2727{
    28   Semaphore_Control *the_semaphore;
    29   ISR_lock_Context   lock_context;
    30   rtems_attribute    attribute_set;
     28  Semaphore_Control    *the_semaphore;
     29  Thread_queue_Context  queue_context;
     30  rtems_attribute       attribute_set;
    3131
    3232  _Objects_Allocator_lock();
    33   the_semaphore = _Semaphore_Get( id, &lock_context );
     33  the_semaphore = _Semaphore_Get(
     34    id,
     35    &queue_context,
     36    _Semaphore_MP_Send_object_was_deleted
     37  );
    3438
    3539  if ( the_semaphore == NULL ) {
     
    5357    _MRSP_Acquire_critical(
    5458      &the_semaphore->Core_control.mrsp,
    55       &lock_context
     59      &queue_context
    5660    );
    5761    mrsp_status = _MRSP_Can_destroy( &the_semaphore->Core_control.mrsp );
     
    5963      _MRSP_Release(
    6064        &the_semaphore->Core_control.mrsp,
    61         &lock_context
     65        &queue_context
    6266      );
    6367      _Objects_Allocator_unlock();
     
    6973    _CORE_mutex_Acquire_critical(
    7074      &the_semaphore->Core_control.mutex,
    71       &lock_context
     75      &queue_context
    7276    );
    7377
     
    7882      _CORE_mutex_Release(
    7983        &the_semaphore->Core_control.mutex,
    80         &lock_context
     84        &queue_context
    8185      );
    8286      _Objects_Allocator_unlock();
     
    8690    _CORE_semaphore_Acquire_critical(
    8791      &the_semaphore->Core_control.semaphore,
    88       &lock_context
     92      &queue_context
    8993    );
    9094  }
     
    9498#if defined(RTEMS_SMP)
    9599  if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
    96     _MRSP_Destroy( &the_semaphore->Core_control.mrsp, &lock_context );
     100    _MRSP_Destroy( &the_semaphore->Core_control.mrsp, &queue_context );
    97101  } else
    98102#endif
     
    101105      &the_semaphore->Core_control.mutex,
    102106      _CORE_mutex_Was_deleted,
    103       _Semaphore_MP_Send_object_was_deleted,
    104       &lock_context
     107      &queue_context
    105108    );
    106109    _CORE_mutex_Destroy( &the_semaphore->Core_control.mutex );
     
    108111    _CORE_semaphore_Destroy(
    109112      &the_semaphore->Core_control.semaphore,
    110       _Semaphore_MP_Send_object_was_deleted,
    111       &lock_context
     113      &queue_context
    112114    );
    113115  }
  • cpukit/rtems/src/semflush.c

    rc3d8d9e r631b3c8  
    2424rtems_status_code rtems_semaphore_flush( rtems_id id )
    2525{
    26   Semaphore_Control *the_semaphore;
    27   ISR_lock_Context   lock_context;
    28   rtems_attribute    attribute_set;
     26  Semaphore_Control    *the_semaphore;
     27  Thread_queue_Context  queue_context;
     28  rtems_attribute       attribute_set;
    2929
    30   the_semaphore = _Semaphore_Get( id, &lock_context );
     30  the_semaphore = _Semaphore_Get(
     31    id,
     32    &queue_context,
     33    _Semaphore_MP_Send_object_was_deleted
     34  );
    3135
    3236  if ( the_semaphore == NULL ) {
     
    4448#if defined(RTEMS_SMP)
    4549  if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
    46     _ISR_lock_ISR_enable( &lock_context );
     50    _ISR_lock_ISR_enable( &queue_context.Lock_context );
    4751    return RTEMS_NOT_DEFINED;
    4852  } else
     
    5155    _CORE_mutex_Acquire_critical(
    5256      &the_semaphore->Core_control.mutex,
    53       &lock_context
     57      &queue_context
    5458    );
    5559    _CORE_mutex_Flush(
    5660      &the_semaphore->Core_control.mutex,
    5761      _CORE_mutex_Unsatisfied_nowait,
    58       _Semaphore_MP_Send_object_was_deleted,
    59       &lock_context
     62      &queue_context
    6063    );
    6164  } else {
    6265    _CORE_semaphore_Acquire_critical(
    6366      &the_semaphore->Core_control.semaphore,
    64       &lock_context
     67      &queue_context
    6568    );
    6669    _CORE_semaphore_Flush(
    6770      &the_semaphore->Core_control.semaphore,
    68       _Semaphore_MP_Send_object_was_deleted,
    69       &lock_context
     71      &queue_context
    7072    );
    7173  }
  • cpukit/rtems/src/semobtain.c

    rc3d8d9e r631b3c8  
    3939)
    4040{
    41   Semaphore_Control *the_semaphore;
    42   ISR_lock_Context   lock_context;
    43   Thread_Control    *executing;
    44   rtems_attribute    attribute_set;
    45   bool               wait;
     41  Semaphore_Control    *the_semaphore;
     42  Thread_queue_Context  queue_context;
     43  Thread_Control       *executing;
     44  rtems_attribute       attribute_set;
     45  bool                  wait;
    4646
    47   the_semaphore = _Semaphore_Get( id, &lock_context );
     47  the_semaphore = _Semaphore_Get( id, &queue_context, NULL );
    4848
    4949  if ( the_semaphore == NULL ) {
     
    6767      wait,
    6868      timeout,
    69       &lock_context
     69      &queue_context
    7070    );
    7171    return _Semaphore_Translate_MRSP_status_code( mrsp_status );
     
    7878      wait,
    7979      timeout,
    80       &lock_context
     80      &queue_context
    8181    );
    8282    return _Semaphore_Translate_core_mutex_return_code(
     
    9191    wait,
    9292    timeout,
    93     &lock_context
     93    &queue_context
    9494  );
    9595  return _Semaphore_Translate_core_semaphore_return_code(
  • cpukit/rtems/src/semrelease.c

    rc3d8d9e r631b3c8  
    3131  CORE_semaphore_Status  semaphore_status;
    3232  rtems_attribute        attribute_set;
    33   ISR_lock_Context       lock_context;
     33  Thread_queue_Context   queue_context;
    3434
    35   the_semaphore = _Semaphore_Get( id, &lock_context );
     35  the_semaphore = _Semaphore_Get(
     36    id,
     37    &queue_context,
     38    _Semaphore_Core_mutex_mp_support
     39  );
    3640
    3741  if ( the_semaphore == NULL ) {
     
    5155      &the_semaphore->Core_control.mrsp,
    5256      _Thread_Executing,
    53       &lock_context
     57      &queue_context
    5458    );
    5559    return _Semaphore_Translate_MRSP_status_code( mrsp_status );
     
    5963    mutex_status = _CORE_mutex_Surrender(
    6064      &the_semaphore->Core_control.mutex,
    61       _Semaphore_Core_mutex_mp_support,
    62       &lock_context
     65      &queue_context
    6366    );
    6467    return _Semaphore_Translate_core_mutex_return_code( mutex_status );
     
    6669    semaphore_status = _CORE_semaphore_Surrender(
    6770      &the_semaphore->Core_control.semaphore,
    68       _Semaphore_Core_mutex_mp_support,
    69       &lock_context
     71      &queue_context
    7072    );
    7173    return _Semaphore_Translate_core_semaphore_return_code( semaphore_status );
  • cpukit/rtems/src/semsetpriority.c

    rc3d8d9e r631b3c8  
    2323
    2424static rtems_status_code _Semaphore_Set_priority(
    25   Semaphore_Control   *the_semaphore,
    26   rtems_id             scheduler_id,
    27   rtems_task_priority  new_priority,
    28   rtems_task_priority *old_priority_p,
    29   ISR_lock_Context    *lock_context
     25  Semaphore_Control    *the_semaphore,
     26  rtems_id              scheduler_id,
     27  rtems_task_priority   new_priority,
     28  rtems_task_priority  *old_priority_p,
     29  Thread_queue_Context *queue_context
    3030)
    3131{
     
    4141    uint32_t scheduler_index = _Scheduler_Get_index_by_id( scheduler_id );
    4242
    43     _MRSP_Acquire_critical( mrsp, lock_context );
     43    _MRSP_Acquire_critical( mrsp, queue_context );
    4444
    4545    old_priority = _MRSP_Get_ceiling_priority( mrsp, scheduler_index );
     
    4949    }
    5050
    51     _MRSP_Release( mrsp, lock_context );
     51    _MRSP_Release( mrsp, queue_context );
    5252
    5353    sc = RTEMS_SUCCESSFUL;
     
    5757    CORE_mutex_Control *mutex = &the_semaphore->Core_control.mutex;
    5858
    59     _CORE_mutex_Acquire_critical( mutex, lock_context );
     59    _CORE_mutex_Acquire_critical( mutex, queue_context );
    6060
    6161    old_priority = mutex->Attributes.priority_ceiling;
     
    6565    }
    6666
    67     _CORE_mutex_Release( mutex, lock_context );
     67    _CORE_mutex_Release( mutex, queue_context );
    6868
    6969    sc = RTEMS_SUCCESSFUL;
    7070  } else {
    71     _ISR_lock_ISR_enable( lock_context );
     71    _ISR_lock_ISR_enable( &queue_context->Lock_context );
    7272
    7373    old_priority = 0;
     
    8888)
    8989{
    90   Semaphore_Control *the_semaphore;
    91   ISR_lock_Context   lock_context;
     90  Semaphore_Control    *the_semaphore;
     91  Thread_queue_Context  queue_context;
    9292
    9393  if ( new_priority != RTEMS_CURRENT_PRIORITY &&
     
    104104  }
    105105
    106   the_semaphore = _Semaphore_Get( semaphore_id, &lock_context );
     106  the_semaphore = _Semaphore_Get( semaphore_id, &queue_context, NULL );
    107107
    108108  if ( the_semaphore == NULL ) {
     
    121121    new_priority,
    122122    old_priority,
    123     &lock_context
     123    &queue_context
    124124  );
    125125}
  • cpukit/score/include/rtems/score/corebarrierimpl.h

    rc3d8d9e r631b3c8  
    8585RTEMS_INLINE_ROUTINE void _CORE_barrier_Acquire_critical(
    8686  CORE_barrier_Control *the_barrier,
    87   ISR_lock_Context     *lock_context
    88 )
    89 {
    90   _Thread_queue_Acquire_critical( &the_barrier->Wait_queue, lock_context );
     87  Thread_queue_Context *queue_context
     88)
     89{
     90  _Thread_queue_Acquire_critical(
     91    &the_barrier->Wait_queue,
     92    &queue_context->Lock_context
     93  );
    9194}
    9295
    9396RTEMS_INLINE_ROUTINE void _CORE_barrier_Release(
    9497  CORE_barrier_Control *the_barrier,
    95   ISR_lock_Context     *lock_context
    96 )
    97 {
    98   _Thread_queue_Release( &the_barrier->Wait_queue, lock_context );
    99 }
    100 
    101 void _CORE_barrier_Do_seize(
    102   CORE_barrier_Control    *the_barrier,
    103   Thread_Control          *executing,
    104   bool                     wait,
    105   Watchdog_Interval        timeout,
    106 #if defined(RTEMS_MULTIPROCESSING)
    107   Thread_queue_MP_callout  mp_callout,
    108 #endif
    109   ISR_lock_Context        *lock_context
    110 );
     98  Thread_queue_Context *queue_context
     99)
     100{
     101  _Thread_queue_Release(
     102    &the_barrier->Wait_queue,
     103    &queue_context->Lock_context
     104  );
     105}
    111106
    112107/**
     
    128123 * @note Status is returned via the thread control block.
    129124 */
    130 #if defined(RTEMS_MULTIPROCESSING)
    131   #define _CORE_barrier_Seize( \
    132     the_barrier, \
    133     executing, \
    134     wait, \
    135     timeout, \
    136     mp_callout, \
    137     lock_context \
    138   ) \
    139     _CORE_barrier_Do_seize( \
    140       the_barrier, \
    141       executing, \
    142       wait, \
    143       timeout, \
    144       mp_callout, \
    145       lock_context \
    146     )
    147 #else
    148   #define _CORE_barrier_Seize( \
    149     the_barrier, \
    150     executing, \
    151     wait, \
    152     timeout, \
    153     mp_callout, \
    154     lock_context \
    155   ) \
    156     _CORE_barrier_Do_seize( \
    157       the_barrier, \
    158       executing, \
    159       wait, \
    160       timeout, \
    161       lock_context \
    162     )
    163 #endif
    164 
    165 uint32_t _CORE_barrier_Do_surrender(
     125void _CORE_barrier_Seize(
     126  CORE_barrier_Control *the_barrier,
     127  Thread_Control       *executing,
     128  bool                  wait,
     129  Watchdog_Interval     timeout,
     130  Thread_queue_Context *queue_context
     131);
     132
     133uint32_t _CORE_barrier_Do_flush(
    166134  CORE_barrier_Control      *the_barrier,
    167135  Thread_queue_Flush_filter  filter,
    168 #if defined(RTEMS_MULTIPROCESSING)
    169   Thread_queue_MP_callout    mp_callout,
    170 #endif
    171   ISR_lock_Context          *lock_context
     136  Thread_queue_Context      *queue_context
    172137);
    173138
     
    184149 *  @retval the number of unblocked threads
    185150 */
    186 #if defined(RTEMS_MULTIPROCESSING)
    187   #define _CORE_barrier_Surrender( \
    188     the_barrier, \
    189     mp_callout, \
    190     lock_context \
    191   ) \
    192     _CORE_barrier_Do_surrender( \
    193       the_barrier, \
    194       _Thread_queue_Flush_default_filter, \
    195       mp_callout, \
    196       lock_context \
    197     )
    198 #else
    199   #define _CORE_barrier_Surrender( \
    200     the_barrier, \
    201     mp_callout, \
    202     lock_context \
    203   ) \
    204     _CORE_barrier_Do_surrender( \
    205       the_barrier, \
    206       _Thread_queue_Flush_default_filter, \
    207       lock_context \
    208     )
    209 #endif
     151RTEMS_INLINE_ROUTINE uint32_t _CORE_barrier_Surrender(
     152  CORE_barrier_Control *the_barrier,
     153  Thread_queue_Context *queue_context
     154)
     155{
     156  return _CORE_barrier_Do_flush(
     157    the_barrier,
     158    _Thread_queue_Flush_default_filter,
     159    queue_context
     160  );
     161}
    210162
    211163Thread_Control *_CORE_barrier_Was_deleted(
    212   Thread_Control     *the_thread,
    213   Thread_queue_Queue *queue,
    214   ISR_lock_Context   *lock_context
    215 );
    216 
    217 /* Must be a macro due to the multiprocessing dependent parameters */
    218 #if defined(RTEMS_MULTIPROCESSING)
    219   #define _CORE_barrier_Flush( \
    220     the_barrier, \
    221     mp_callout, \
    222     lock_context \
    223   ) \
    224     _CORE_barrier_Do_surrender( \
    225       the_barrier, \
    226       _CORE_barrier_Was_deleted, \
    227       mp_callout, \
    228       lock_context \
    229     )
    230 #else
    231   #define _CORE_barrier_Flush( \
    232     the_barrier, \
    233     mp_callout, \
    234     lock_context \
    235   ) \
    236     _CORE_barrier_Do_surrender( \
    237       the_barrier, \
    238       _CORE_barrier_Was_deleted, \
    239       lock_context \
    240     )
    241 #endif
     164  Thread_Control       *the_thread,
     165  Thread_queue_Queue   *queue,
     166  Thread_queue_Context *queue_context
     167);
     168
     169RTEMS_INLINE_ROUTINE void _CORE_barrier_Flush(
     170  CORE_barrier_Control *the_barrier,
     171  Thread_queue_Context *queue_context
     172)
     173{
     174  _CORE_barrier_Do_flush(
     175    the_barrier,
     176    _CORE_barrier_Was_deleted,
     177    queue_context
     178  );
     179}
    242180
    243181/**
  • cpukit/score/include/rtems/score/coremsg.h

    rc3d8d9e r631b3c8  
    123123  typedef void (*CORE_message_queue_Notify_Handler)(
    124124    CORE_message_queue_Control *,
    125     ISR_lock_Context *
     125    Thread_queue_Context *
    126126  );
    127127#endif
  • cpukit/score/include/rtems/score/coremsgimpl.h

    rc3d8d9e r631b3c8  
    127127);
    128128
    129 void _CORE_message_queue_Do_close(
    130   CORE_message_queue_Control *the_message_queue,
    131 #if defined(RTEMS_MULTIPROCESSING)
    132   Thread_queue_MP_callout     mp_callout,
    133 #endif
    134   ISR_lock_Context           *lock_context
    135 );
    136 
    137129/**
    138130 *  @brief Close a message queue.
     
    146138 *
    147139 *  @param[in] the_message_queue points to the message queue to close
    148  *  @param[in] mp_callout is the routine to call for each thread
    149  *         that is extracted from the set of waiting threads
    150  *  @param[in] lock_context The lock context of the
     140 *  @param[in] queue_context The thread queue context used for
    151141 *    _CORE_message_queue_Acquire() or _CORE_message_queue_Acquire_critical().
    152142 */
    153 #if defined(RTEMS_MULTIPROCESSING)
    154   #define _CORE_message_queue_Close( \
    155     the_message_queue, \
    156     mp_callout, \
    157     lock_context \
    158   ) \
    159     _CORE_message_queue_Do_close( \
    160       the_message_queue, \
    161       mp_callout, \
    162       lock_context \
    163     )
    164 #else
    165   #define _CORE_message_queue_Close( \
    166     the_message_queue, \
    167     mp_callout, \
    168     lock_context \
    169   ) \
    170     _CORE_message_queue_Do_close( \
    171       the_message_queue, \
    172       lock_context \
    173     )
    174 #endif
     143void _CORE_message_queue_Close(
     144  CORE_message_queue_Control *the_message_queue,
     145  Thread_queue_Context       *queue_context
     146);
    175147
    176148/**
     
    185157 *
    186158 *  @param[in] the_message_queue points to the message queue to flush
    187  *  @param[in] lock_context The lock context of the interrupt disable.
     159 *  @param[in] queue_context The thread queue context with interrupts disabled.
    188160 *
    189161 *  @retval This method returns the number of message pending messages flushed.
     
    191163uint32_t   _CORE_message_queue_Flush(
    192164  CORE_message_queue_Control *the_message_queue,
    193   ISR_lock_Context           *lock_context
     165  Thread_queue_Context       *queue_context
    194166);
    195167
     
    211183#endif
    212184
    213 CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
    214   CORE_message_queue_Control *the_message_queue,
    215   const void                 *buffer,
    216   size_t                      size,
    217 #if defined(RTEMS_MULTIPROCESSING)
    218   Thread_queue_MP_callout     mp_callout,
    219 #endif
    220   uint32_t                   *count,
    221   ISR_lock_Context           *lock_context
    222 );
    223 
    224185/**
    225186 *  @brief Broadcast a message to the message queue.
     
    235196 *  @param[in] buffer is the starting address of the message to broadcast
    236197 *  @param[in] size is the size of the message being broadcast
    237  *  @param[in] mp_callout is the routine to invoke if
    238  *         a thread that is unblocked is actually a remote thread.
    239198 *  @param[out] count points to the variable that will contain the
    240199 *         number of tasks that are sent this message
    241  *  @param[in] lock_context The lock context of the interrupt disable.
     200 *  @param[in] queue_context The thread queue context used for
     201 *    _CORE_message_queue_Acquire() or _CORE_message_queue_Acquire_critical().
    242202 *  @retval @a *count will contain the number of messages sent
    243203 *  @retval indication of the successful completion or reason for failure
    244204 */
    245 #if defined(RTEMS_MULTIPROCESSING)
    246   #define _CORE_message_queue_Broadcast( \
    247     the_message_queue, \
    248     buffer, \
    249     size, \
    250     mp_callout, \
    251     count, \
    252     lock_context \
    253   ) \
    254     _CORE_message_queue_Do_broadcast( \
    255       the_message_queue, \
    256       buffer, \
    257       size, \
    258       mp_callout, \
    259       count, \
    260       lock_context \
    261     )
    262 #else
    263   #define _CORE_message_queue_Broadcast( \
    264     the_message_queue, \
    265     buffer, \
    266     size, \
    267     mp_callout, \
    268     count, \
    269     lock_context \
    270   ) \
    271     _CORE_message_queue_Do_broadcast( \
    272       the_message_queue, \
    273       buffer, \
    274       size, \
    275       count, \
    276       lock_context \
    277     )
    278 #endif
    279 
    280 CORE_message_queue_Status _CORE_message_queue_Do_submit(
    281   CORE_message_queue_Control       *the_message_queue,
    282   Thread_Control                   *executing,
    283   const void                       *buffer,
    284   size_t                            size,
    285 #if defined(RTEMS_MULTIPROCESSING)
    286   Thread_queue_MP_callout           mp_callout,
    287 #endif
    288   CORE_message_queue_Submit_types   submit_type,
    289   bool                              wait,
    290   Watchdog_Interval                 timeout,
    291   ISR_lock_Context                 *lock_context
     205CORE_message_queue_Status _CORE_message_queue_Broadcast(
     206  CORE_message_queue_Control *the_message_queue,
     207  const void                 *buffer,
     208  size_t                      size,
     209  uint32_t                   *count,
     210  Thread_queue_Context       *queue_context
    292211);
    293212
     
    305224 *  @param[in] buffer is the starting address of the message to send
    306225 *  @param[in] size is the size of the message being send
    307  *  @param[in] mp_callout is the routine to invoke if
    308  *         a thread that is unblocked is actually a remote thread.
    309226 *  @param[in] submit_type determines whether the message is prepended,
    310227 *         appended, or enqueued in priority order.
     
    313230 *  @param[in] timeout is the maximum number of clock ticks that the calling
    314231 *         thread is willing to block if the message queue is full.
    315  *  @param[in] lock_context The lock context of the interrupt disable.
     232 *  @param[in] queue_context The thread queue context used for
     233 *    _CORE_message_queue_Acquire() or _CORE_message_queue_Acquire_critical().
    316234 *  @retval indication of the successful completion or reason for failure
    317235 */
    318 #if defined(RTEMS_MULTIPROCESSING)
    319   #define _CORE_message_queue_Submit( \
    320     the_message_queue, \
    321     executing, \
    322     buffer, \
    323     size, \
    324     mp_callout, \
    325     submit_type, \
    326     wait, \
    327     timeout, \
    328     lock_context \
    329   ) \
    330     _CORE_message_queue_Do_submit( \
    331       the_message_queue, \
    332       executing, \
    333       buffer, \
    334       size, \
    335       mp_callout, \
    336       submit_type, \
    337       wait, \
    338       timeout, \
    339       lock_context \
    340     )
    341 #else
    342   #define _CORE_message_queue_Submit( \
    343     the_message_queue, \
    344     executing, \
    345     buffer, \
    346     size, \
    347     mp_callout, \
    348     submit_type, \
    349     wait, \
    350     timeout, \
    351     lock_context \
    352   ) \
    353     _CORE_message_queue_Do_submit( \
    354       the_message_queue, \
    355       executing, \
    356       buffer, \
    357       size, \
    358       submit_type, \
    359       wait, \
    360       timeout, \
    361       lock_context \
    362     )
    363 #endif
     236CORE_message_queue_Status _CORE_message_queue_Submit(
     237  CORE_message_queue_Control       *the_message_queue,
     238  Thread_Control                   *executing,
     239  const void                       *buffer,
     240  size_t                            size,
     241  CORE_message_queue_Submit_types   submit_type,
     242  bool                              wait,
     243  Watchdog_Interval                 timeout,
     244  Thread_queue_Context             *queue_context
     245);
    364246
    365247/**
     
    384266 *  @param[in] timeout is the maximum number of clock ticks that the calling
    385267 *         thread is willing to block if the message queue is empty.
    386  *  @param[in] lock_context The lock context of the interrupt disable.
     268 *  @param[in] queue_context The thread queue context used for
     269 *    _CORE_message_queue_Acquire() or _CORE_message_queue_Acquire_critical().
    387270 *
    388271 *  @retval indication of the successful completion or reason for failure.
     
    397280 */
    398281void _CORE_message_queue_Seize(
    399   CORE_message_queue_Control      *the_message_queue,
    400   Thread_Control                  *executing,
    401   void                            *buffer,
    402   size_t                          *size_p,
    403   bool                             wait,
    404   Watchdog_Interval                timeout,
    405   ISR_lock_Context                *lock_context
     282  CORE_message_queue_Control *the_message_queue,
     283  Thread_Control             *executing,
     284  void                       *buffer,
     285  size_t                     *size_p,
     286  bool                        wait,
     287  Watchdog_Interval           timeout,
     288  Thread_queue_Context       *queue_context
    406289);
    407290
     
    427310);
    428311
    429 /**
    430  * This routine sends a message to the end of the specified message queue.
    431  */
    432 #define _CORE_message_queue_Send( \
    433   the_message_queue, \
    434   buffer, \
    435   size, \
    436   mp_callout, \
    437   wait, \
    438   timeout, \
    439   lock_context \
    440 ) \
    441   _CORE_message_queue_Submit( \
    442     the_message_queue, \
    443     _Thread_Executing, \
    444     buffer, \
    445     size, \
    446     mp_callout, \
    447     CORE_MESSAGE_QUEUE_SEND_REQUEST, \
    448     wait, \
    449     timeout, \
    450     lock_context \
    451   )
    452 
    453 /**
    454  * This routine sends a message to the front of the specified message queue.
    455  */
    456 #define _CORE_message_queue_Urgent( \
    457   the_message_queue, \
    458   buffer, \
    459   size, \
    460   mp_callout, \
    461   wait, \
    462   timeout, \
    463   lock_context \
    464 ) \
    465   _CORE_message_queue_Submit( \
    466     the_message_queue, \
    467     _Thread_Executing, \
    468     buffer, \
    469     size, \
    470     mp_callout, \
    471     CORE_MESSAGE_QUEUE_URGENT_REQUEST, \
    472     wait,\
    473     timeout, \
    474     lock_context \
    475  )
     312RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
     313  CORE_message_queue_Control       *the_message_queue,
     314  const void                       *buffer,
     315  size_t                            size,
     316  bool                              wait,
     317  Watchdog_Interval                 timeout,
     318  Thread_queue_Context             *queue_context
     319)
     320{
     321  return _CORE_message_queue_Submit(
     322    the_message_queue,
     323    _Thread_Executing,
     324    buffer,
     325    size,
     326    CORE_MESSAGE_QUEUE_SEND_REQUEST,
     327    wait,
     328    timeout,
     329    queue_context
     330  );
     331}
     332
     333RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
     334  CORE_message_queue_Control       *the_message_queue,
     335  const void                       *buffer,
     336  size_t                            size,
     337  bool                              wait,
     338  Watchdog_Interval                 timeout,
     339  Thread_queue_Context             *queue_context
     340)
     341{
     342  return _CORE_message_queue_Submit(
     343    the_message_queue,
     344    _Thread_Executing,
     345    buffer,
     346    size,
     347    CORE_MESSAGE_QUEUE_URGENT_REQUEST,
     348    wait,
     349    timeout,
     350    queue_context
     351  );
     352}
    476353
    477354RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire(
    478355  CORE_message_queue_Control *the_message_queue,
    479   ISR_lock_Context           *lock_context
    480 )
    481 {
    482   _Thread_queue_Acquire( &the_message_queue->Wait_queue, lock_context );
     356  Thread_queue_Context       *queue_context
     357)
     358{
     359  _Thread_queue_Acquire(
     360    &the_message_queue->Wait_queue,
     361    &queue_context->Lock_context
     362  );
    483363}
    484364
    485365RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire_critical(
    486366  CORE_message_queue_Control *the_message_queue,
    487   ISR_lock_Context           *lock_context
    488 )
    489 {
    490   _Thread_queue_Acquire_critical( &the_message_queue->Wait_queue, lock_context );
     367  Thread_queue_Context       *queue_context
     368)
     369{
     370  _Thread_queue_Acquire_critical(
     371    &the_message_queue->Wait_queue,
     372    &queue_context->Lock_context
     373  );
    491374}
    492375
    493376RTEMS_INLINE_ROUTINE void _CORE_message_queue_Release(
    494377  CORE_message_queue_Control *the_message_queue,
    495   ISR_lock_Context           *lock_context
    496 )
    497 {
    498   _Thread_queue_Release( &the_message_queue->Wait_queue, lock_context );
     378  Thread_queue_Context       *queue_context
     379)
     380{
     381  _Thread_queue_Release(
     382    &the_message_queue->Wait_queue,
     383    &queue_context->Lock_context
     384  );
    499385}
    500386
     
    598484#endif
    599485
    600 RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Do_dequeue_receiver(
     486RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
    601487  CORE_message_queue_Control      *the_message_queue,
    602488  const void                      *buffer,
    603489  size_t                           size,
    604 #if defined(RTEMS_MULTIPROCESSING)
    605   Thread_queue_MP_callout          mp_callout,
    606 #endif
    607490  CORE_message_queue_Submit_types  submit_type,
    608   ISR_lock_Context                *lock_context
     491  Thread_queue_Context            *queue_context
    609492)
    610493{
     
    648531    the_message_queue->operations,
    649532    the_thread,
    650     mp_callout,
    651     lock_context
     533    queue_context
    652534  );
    653535
    654536  return the_thread;
    655537}
    656 
    657 #if defined(RTEMS_MULTIPROCESSING)
    658   #define _CORE_message_queue_Dequeue_receiver( \
    659     the_message_queue, \
    660     buffer, \
    661     size, \
    662     mp_callout, \
    663     submit_type, \
    664     lock_context \
    665   ) \
    666     _CORE_message_queue_Do_dequeue_receiver( \
    667       the_message_queue, \
    668       buffer, \
    669       size, \
    670       mp_callout, \
    671       submit_type, \
    672       lock_context \
    673     )
    674 #else
    675   #define _CORE_message_queue_Dequeue_receiver( \
    676     the_message_queue, \
    677     buffer, \
    678     size, \
    679     mp_callout, \
    680     submit_type, \
    681     lock_context \
    682   ) \
    683     _CORE_message_queue_Do_dequeue_receiver( \
    684       the_message_queue, \
    685       buffer, \
    686       size, \
    687       submit_type, \
    688       lock_context \
    689     )
    690 #endif
    691538
    692539/** @} */
  • cpukit/score/include/rtems/score/coremuteximpl.h

    rc3d8d9e r631b3c8  
    108108
    109109RTEMS_INLINE_ROUTINE void _CORE_mutex_Acquire_critical(
    110   CORE_mutex_Control *the_mutex,
    111   ISR_lock_Context   *lock_context
    112 )
    113 {
    114   _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context );
     110  CORE_mutex_Control   *the_mutex,
     111  Thread_queue_Context *queue_context
     112)
     113{
     114  _Thread_queue_Acquire_critical(
     115    &the_mutex->Wait_queue,
     116    &queue_context->Lock_context
     117  );
    115118}
    116119
    117120RTEMS_INLINE_ROUTINE void _CORE_mutex_Release(
    118   CORE_mutex_Control *the_mutex,
    119   ISR_lock_Context   *lock_context
    120 )
    121 {
    122   _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     121  CORE_mutex_Control   *the_mutex,
     122  Thread_queue_Context *queue_context
     123)
     124{
     125  _Thread_queue_Release(
     126    &the_mutex->Wait_queue,
     127    &queue_context->Lock_context
     128  );
    123129}
    124130
     
    220226 *  @param[in,out] executing The currently executing thread.
    221227 *  @param[in,out] the_mutex is the mutex to attempt to lock
    222  *  @param[in] lock_context is the interrupt level
     228 *  @param[in] queue_context is the interrupt level
    223229 *
    224230 *  @retval This routine returns 0 if "trylock" can resolve whether or not
     
    228234 */
    229235RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
    230   CORE_mutex_Control  *the_mutex,
    231   Thread_Control      *executing,
    232   ISR_lock_Context    *lock_context
     236  CORE_mutex_Control   *the_mutex,
     237  Thread_Control       *executing,
     238  Thread_queue_Context *queue_context
    233239)
    234240{
     
    245251
    246252    if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
    247       _CORE_mutex_Release( the_mutex, lock_context );
     253      _CORE_mutex_Release( the_mutex, queue_context );
    248254      return 0;
    249255    } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
     
    259265      current = executing->current_priority;
    260266      if ( current == ceiling ) {
    261         _CORE_mutex_Release( the_mutex, lock_context );
     267        _CORE_mutex_Release( the_mutex, queue_context );
    262268        return 0;
    263269      }
     
    266272        Per_CPU_Control *cpu_self;
    267273
    268         cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    269         _CORE_mutex_Release( the_mutex, lock_context );
     274        cpu_self = _Thread_Dispatch_disable_critical(
     275          &queue_context->Lock_context
     276        );
     277        _CORE_mutex_Release( the_mutex, queue_context );
    270278        _Thread_Raise_priority( executing, ceiling );
    271279        _Thread_Dispatch_enable( cpu_self );
     
    277285        the_mutex->nest_count = 0;     /* undo locking above */
    278286        executing->resource_count--;   /* undo locking above */
    279         _CORE_mutex_Release( the_mutex, lock_context );
     287        _CORE_mutex_Release( the_mutex, queue_context );
    280288        return 0;
    281289      }
     
    293301      case CORE_MUTEX_NESTING_ACQUIRES:
    294302        the_mutex->nest_count++;
    295         _CORE_mutex_Release( the_mutex, lock_context );
     303        _CORE_mutex_Release( the_mutex, queue_context );
    296304        return 0;
    297305      #if defined(RTEMS_POSIX_API)
    298306        case CORE_MUTEX_NESTING_IS_ERROR:
    299307          executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
    300           _CORE_mutex_Release( the_mutex, lock_context );
     308          _CORE_mutex_Release( the_mutex, queue_context );
    301309          return 0;
    302310      #endif
     
    323331 *  @param[in] wait is true if the thread is willing to wait
    324332 *  @param[in] timeout is the maximum number of ticks to block
    325  *  @param[in] lock_context is a temporary variable used to contain the ISR
     333 *  @param[in] queue_context is a temporary variable used to contain the ISR
    326334 *         disable level cookie
    327335 *
     
    340348 */
    341349RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize(
    342   CORE_mutex_Control  *the_mutex,
    343   Thread_Control      *executing,
    344   bool                 wait,
    345   Watchdog_Interval    timeout,
    346   ISR_lock_Context    *lock_context
     350  CORE_mutex_Control   *the_mutex,
     351  Thread_Control       *executing,
     352  bool                  wait,
     353  Watchdog_Interval     timeout,
     354  Thread_queue_Context *queue_context
    347355)
    348356{
     
    354362    );
    355363  }
    356   _CORE_mutex_Acquire_critical( the_mutex, lock_context );
    357   if ( _CORE_mutex_Seize_interrupt_trylock( the_mutex, executing, lock_context ) ) {
     364  _CORE_mutex_Acquire_critical( the_mutex, queue_context );
     365  if (
     366    _CORE_mutex_Seize_interrupt_trylock( the_mutex, executing, queue_context )
     367  ) {
    358368    if ( !wait ) {
    359       _CORE_mutex_Release( the_mutex, lock_context );
     369      _CORE_mutex_Release( the_mutex, queue_context );
    360370      executing->Wait.return_code =
    361371        CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT;
     
    365375        executing,
    366376        timeout,
    367         lock_context
     377        &queue_context->Lock_context
    368378      );
    369379    }
     
    371381}
    372382
    373 CORE_mutex_Status _CORE_mutex_Do_surrender(
    374   CORE_mutex_Control      *the_mutex,
    375 #if defined(RTEMS_MULTIPROCESSING)
    376   Thread_queue_MP_callout  mp_callout,
    377 #endif
    378   ISR_lock_Context        *lock_context
     383CORE_mutex_Status _CORE_mutex_Surrender(
     384  CORE_mutex_Control   *the_mutex,
     385  Thread_queue_Context *queue_context
    379386);
    380387
    381 #if defined(RTEMS_MULTIPROCESSING)
    382   #define _CORE_mutex_Surrender( \
    383     the_mutex, \
    384     mp_callout, \
    385     lock_context \
    386   ) \
    387     _CORE_mutex_Do_surrender( \
    388       the_mutex, \
    389       mp_callout, \
    390       lock_context \
    391     )
    392 #else
    393   #define _CORE_mutex_Surrender( \
    394     the_mutex, \
    395     mp_callout, \
    396     lock_context \
    397   ) \
    398     _CORE_mutex_Do_surrender( \
    399       the_mutex, \
    400       lock_context \
    401     )
    402 #endif
    403 
    404388Thread_Control *_CORE_mutex_Was_deleted(
    405   Thread_Control     *the_thread,
    406   Thread_queue_Queue *queue,
    407   ISR_lock_Context   *lock_context
     389  Thread_Control       *the_thread,
     390  Thread_queue_Queue   *queue,
     391  Thread_queue_Context *queue_context
    408392);
    409393
    410394Thread_Control *_CORE_mutex_Unsatisfied_nowait(
    411   Thread_Control     *the_thread,
    412   Thread_queue_Queue *queue,
    413   ISR_lock_Context   *lock_context
     395  Thread_Control       *the_thread,
     396  Thread_queue_Queue   *queue,
     397  Thread_queue_Context *queue_context
    414398);
    415399
    416 /* Must be a macro due to the multiprocessing dependent parameters */
    417 #define _CORE_mutex_Flush( \
    418   the_mutex, \
    419   filter, \
    420   mp_callout, \
    421   lock_context \
    422 ) \
    423   _Thread_queue_Flush_critical( \
    424     &( the_mutex )->Wait_queue.Queue, \
    425     ( the_mutex )->operations, \
    426     filter, \
    427     mp_callout, \
    428     lock_context \
    429   )
     400RTEMS_INLINE_ROUTINE void _CORE_mutex_Flush(
     401  CORE_mutex_Control        *the_mutex,
     402  Thread_queue_Flush_filter  filter,
     403  Thread_queue_Context      *queue_context
     404)
     405{
     406  _Thread_queue_Flush_critical(
     407    &the_mutex->Wait_queue.Queue,
     408    the_mutex->operations,
     409    filter,
     410    queue_context
     411  );
     412}
    430413
    431414RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_owner(
  • cpukit/score/include/rtems/score/corerwlockimpl.h

    rc3d8d9e r631b3c8  
    8888
    8989RTEMS_INLINE_ROUTINE void _CORE_RWLock_Acquire_critical(
    90   CORE_RWLock_Control *the_rwlock,
    91   ISR_lock_Context    *lock_context
     90  CORE_RWLock_Control  *the_rwlock,
     91  Thread_queue_Context *queue_context
    9292)
    9393{
    94   _Thread_queue_Acquire_critical( &the_rwlock->Wait_queue, lock_context );
     94  _Thread_queue_Acquire_critical(
     95    &the_rwlock->Wait_queue,
     96    &queue_context->Lock_context
     97  );
    9598}
    9699
    97100RTEMS_INLINE_ROUTINE void _CORE_RWLock_Release(
    98   CORE_RWLock_Control *the_rwlock,
    99   ISR_lock_Context    *lock_context
     101  CORE_RWLock_Control  *the_rwlock,
     102  Thread_queue_Context *queue_context
    100103)
    101104{
    102   _Thread_queue_Release( &the_rwlock->Wait_queue, lock_context );
     105  _Thread_queue_Release(
     106    &the_rwlock->Wait_queue,
     107    &queue_context->Lock_context
     108  );
    103109}
    104110
     
    117123
    118124void _CORE_RWLock_Seize_for_reading(
    119   CORE_RWLock_Control *the_rwlock,
    120   Thread_Control      *executing,
    121   bool                 wait,
    122   Watchdog_Interval    timeout,
    123   ISR_lock_Context    *lock_context
     125  CORE_RWLock_Control  *the_rwlock,
     126  Thread_Control       *executing,
     127  bool                  wait,
     128  Watchdog_Interval     timeout,
     129  Thread_queue_Context *queue_context
    124130);
    125131
     
    137143 */
    138144void _CORE_RWLock_Seize_for_writing(
    139   CORE_RWLock_Control *the_rwlock,
    140   Thread_Control      *executing,
    141   bool                 wait,
    142   Watchdog_Interval    timeout,
    143   ISR_lock_Context    *lock_context
     145  CORE_RWLock_Control  *the_rwlock,
     146  Thread_Control       *executing,
     147  bool                  wait,
     148  Watchdog_Interval     timeout,
     149  Thread_queue_Context *queue_context
    144150);
    145151
     
    155161 */
    156162CORE_RWLock_Status _CORE_RWLock_Surrender(
    157   CORE_RWLock_Control *the_rwlock,
    158   ISR_lock_Context    *lock_context
     163  CORE_RWLock_Control  *the_rwlock,
     164  Thread_queue_Context *queue_context
    159165);
    160166
  • cpukit/score/include/rtems/score/coresemimpl.h

    rc3d8d9e r631b3c8  
    8989RTEMS_INLINE_ROUTINE void _CORE_semaphore_Acquire_critical(
    9090  CORE_semaphore_Control *the_semaphore,
    91   ISR_lock_Context       *lock_context
    92 )
    93 {
    94   _Thread_queue_Acquire_critical( &the_semaphore->Wait_queue, lock_context );
     91  Thread_queue_Context   *queue_context
     92)
     93{
     94  _Thread_queue_Acquire_critical(
     95    &the_semaphore->Wait_queue,
     96    &queue_context->Lock_context
     97  );
    9598}
    9699
    97100RTEMS_INLINE_ROUTINE void _CORE_semaphore_Release(
    98101  CORE_semaphore_Control *the_semaphore,
    99   ISR_lock_Context       *lock_context
    100 )
    101 {
    102   _Thread_queue_Release( &the_semaphore->Wait_queue, lock_context );
     102  Thread_queue_Context   *queue_context
     103)
     104{
     105  _Thread_queue_Release(
     106    &the_semaphore->Wait_queue,
     107    &queue_context->Lock_context
     108  );
    103109}
    104110
    105111Thread_Control *_CORE_semaphore_Was_deleted(
    106   Thread_Control     *the_thread,
    107   Thread_queue_Queue *queue,
    108   ISR_lock_Context   *lock_context
     112  Thread_Control       *the_thread,
     113  Thread_queue_Queue   *queue,
     114  Thread_queue_Context *queue_context
    109115);
    110116
    111117Thread_Control *_CORE_semaphore_Unsatisfied_nowait(
    112   Thread_Control     *the_thread,
    113   Thread_queue_Queue *queue,
    114   ISR_lock_Context   *lock_context
     118  Thread_Control       *the_thread,
     119  Thread_queue_Queue   *queue,
     120  Thread_queue_Context *queue_context
    115121);
    116122
    117 #define _CORE_semaphore_Destroy( \
    118   the_semaphore, \
    119   mp_callout, \
    120   lock_context \
    121 ) \
    122   do { \
    123     _Thread_queue_Flush_critical( \
    124       &( the_semaphore )->Wait_queue.Queue, \
    125       ( the_semaphore )->operations, \
    126       _CORE_semaphore_Was_deleted, \
    127       mp_callout, \
    128       lock_context \
    129     ); \
    130     _Thread_queue_Destroy( &( the_semaphore )->Wait_queue ); \
    131   } while ( 0 )
    132 
    133 RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Do_surrender(
     123RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
     124  CORE_semaphore_Control *the_semaphore,
     125  Thread_queue_Context   *queue_context
     126)
     127{
     128  _Thread_queue_Flush_critical(
     129    &the_semaphore->Wait_queue.Queue,
     130    the_semaphore->operations,
     131    _CORE_semaphore_Was_deleted,
     132    queue_context
     133  );
     134  _Thread_queue_Destroy( &the_semaphore->Wait_queue );
     135}
     136
     137/**
     138 *  @brief Surrender a unit to a semaphore.
     139 *
     140 *  This routine frees a unit to the semaphore.  If a task was blocked waiting
     141 *  for a unit from this semaphore, then that task will be readied and the unit
     142 *  given to that task.  Otherwise, the unit will be returned to the semaphore.
     143 *
     144 *  @param[in] the_semaphore is the semaphore to surrender
     145 *  @param[in] queue_context is a temporary variable used to contain the ISR
     146 *        disable level cookie
     147 *
     148 *  @retval an indication of whether the routine succeeded or failed
     149 */
     150RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
    134151  CORE_semaphore_Control  *the_semaphore,
    135 #if defined(RTEMS_MULTIPROCESSING)
    136   Thread_queue_MP_callout  mp_callout,
    137 #endif
    138   ISR_lock_Context        *lock_context
     152  Thread_queue_Context    *queue_context
    139153)
    140154{
     
    144158  status = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
    145159
    146   _CORE_semaphore_Acquire_critical( the_semaphore, lock_context );
     160  _CORE_semaphore_Acquire_critical( the_semaphore, queue_context );
    147161
    148162  the_thread = _Thread_queue_First_locked(
     
    155169      the_semaphore->operations,
    156170      the_thread,
    157       mp_callout,
    158       lock_context
     171      queue_context
    159172    );
    160173  } else {
     
    164177      status = CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED;
    165178
    166     _CORE_semaphore_Release( the_semaphore, lock_context );
     179    _CORE_semaphore_Release( the_semaphore, queue_context );
    167180  }
    168181
     
    170183}
    171184
    172 /**
    173  *  @brief Surrender a unit to a semaphore.
    174  *
    175  *  This routine frees a unit to the semaphore.  If a task was blocked waiting
    176  *  for a unit from this semaphore, then that task will be readied and the unit
    177  *  given to that task.  Otherwise, the unit will be returned to the semaphore.
    178  *
    179  *  @param[in] the_semaphore is the semaphore to surrender
    180  *  @param[in] mp_callout is the routine to invoke if the
    181  *         thread unblocked is remote
    182  *  @param[in] lock_context is a temporary variable used to contain the ISR
    183  *        disable level cookie
    184  *
    185  *  @retval an indication of whether the routine succeeded or failed
    186  */
    187 #if defined(RTEMS_MULTIPROCESSING)
    188   #define _CORE_semaphore_Surrender( \
    189     the_semaphore, \
    190     mp_callout, \
    191     lock_context \
    192   ) \
    193     _CORE_semaphore_Do_surrender( \
    194       the_semaphore, \
    195       mp_callout, \
    196       lock_context \
    197     )
    198 #else
    199   #define _CORE_semaphore_Surrender( \
    200     the_semaphore, \
    201     mp_callout, \
    202     lock_context \
    203   ) \
    204     _CORE_semaphore_Do_surrender( \
    205       the_semaphore, \
    206       lock_context \
    207     )
    208 #endif
    209 
    210 /* Must be a macro due to the multiprocessing dependent parameters */
    211 #define _CORE_semaphore_Flush( \
    212   the_semaphore, \
    213   mp_callout, \
    214   lock_context \
    215 ) \
    216   do { \
    217     _Thread_queue_Flush_critical( \
    218       &( the_semaphore )->Wait_queue.Queue, \
    219       ( the_semaphore )->operations, \
    220       _CORE_semaphore_Unsatisfied_nowait, \
    221       mp_callout, \
    222       lock_context \
    223     ); \
    224   } while ( 0 )
     185RTEMS_INLINE_ROUTINE void _CORE_semaphore_Flush(
     186  CORE_semaphore_Control *the_semaphore,
     187  Thread_queue_Context   *queue_context
     188)
     189{
     190  _Thread_queue_Flush_critical(
     191    &the_semaphore->Wait_queue.Queue,
     192    the_semaphore->operations,
     193    _CORE_semaphore_Unsatisfied_nowait,
     194    queue_context
     195  );
     196}
    225197
    226198/**
     
    248220 * @param[in] wait is true if the thread is willing to wait
    249221 * @param[in] timeout is the maximum number of ticks to block
    250  * @param[in] lock_context is a temporary variable used to contain the ISR
     222 * @param[in] queue_context is a temporary variable used to contain the ISR
    251223 *        disable level cookie
    252224 *
     
    254226 */
    255227RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize(
    256   CORE_semaphore_Control  *the_semaphore,
    257   Thread_Control          *executing,
    258   bool                     wait,
    259   Watchdog_Interval        timeout,
    260   ISR_lock_Context        *lock_context
     228  CORE_semaphore_Control *the_semaphore,
     229  Thread_Control         *executing,
     230  bool                    wait,
     231  Watchdog_Interval       timeout,
     232  Thread_queue_Context   *queue_context
    261233)
    262234{
     
    264236
    265237  executing->Wait.return_code = CORE_SEMAPHORE_STATUS_SUCCESSFUL;
    266   _CORE_semaphore_Acquire_critical( the_semaphore, lock_context );
     238  _CORE_semaphore_Acquire_critical( the_semaphore, queue_context );
    267239  if ( the_semaphore->count != 0 ) {
    268240    the_semaphore->count -= 1;
    269     _CORE_semaphore_Release( the_semaphore, lock_context );
     241    _CORE_semaphore_Release( the_semaphore, queue_context );
    270242    return;
    271243  }
    272244
    273245  if ( !wait ) {
    274     _CORE_semaphore_Release( the_semaphore, lock_context );
     246    _CORE_semaphore_Release( the_semaphore, queue_context );
    275247    executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
    276248    return;
     
    284256    timeout,
    285257    CORE_SEMAPHORE_TIMEOUT,
    286     lock_context
     258    &queue_context->Lock_context
    287259  );
    288260}
  • cpukit/score/include/rtems/score/mrspimpl.h

    rc3d8d9e r631b3c8  
    5555
    5656RTEMS_INLINE_ROUTINE void _MRSP_Acquire_critical(
    57   MRSP_Control     *mrsp,
    58   ISR_lock_Context *lock_context
    59 )
    60 {
    61   _ISR_lock_Acquire( &mrsp->Lock, lock_context );
     57  MRSP_Control         *mrsp,
     58  Thread_queue_Context *queue_context
     59)
     60{
     61  _ISR_lock_Acquire( &mrsp->Lock, &queue_context->Lock_context );
    6262}
    6363
    6464RTEMS_INLINE_ROUTINE void _MRSP_Release(
    65   MRSP_Control     *mrsp,
    66   ISR_lock_Context *lock_context
    67 )
    68 {
    69   _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, lock_context );
     65  MRSP_Control         *mrsp,
     66  Thread_queue_Context *queue_context
     67)
     68{
     69  _ISR_lock_Release_and_ISR_enable( &mrsp->Lock, &queue_context->Lock_context );
    7070}
    7171
     
    105105
    106106RTEMS_INLINE_ROUTINE void _MRSP_Claim_ownership(
    107   MRSP_Control     *mrsp,
    108   Thread_Control   *new_owner,
    109   Priority_Control  initial_priority,
    110   Priority_Control  ceiling_priority,
    111   ISR_lock_Context *lock_context
     107  MRSP_Control         *mrsp,
     108  Thread_Control       *new_owner,
     109  Priority_Control      initial_priority,
     110  Priority_Control      ceiling_priority,
     111  Thread_queue_Context *queue_context
    112112)
    113113{
     
    119119  _Scheduler_Thread_change_help_state( new_owner, SCHEDULER_HELP_ACTIVE_OWNER );
    120120
    121   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    122   _MRSP_Release( mrsp, lock_context );
     121  cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     122  _MRSP_Release( mrsp, queue_context );
    123123
    124124  _Thread_Raise_priority( new_owner, ceiling_priority );
     
    181181  MRSP_Control *mrsp = rival->resource;
    182182  Thread_Control *thread = rival->thread;
    183   ISR_lock_Context lock_context;
    184 
    185   _ISR_lock_ISR_disable( &lock_context );
    186   _MRSP_Acquire_critical( mrsp, &lock_context );
     183  Thread_queue_Context queue_context;
     184
     185  _Thread_queue_Context_initialize( &queue_context, NULL );
     186  _ISR_lock_ISR_disable( &queue_context.Lock_context );
     187  _MRSP_Acquire_critical( mrsp, &queue_context );
    187188
    188189  if ( rival->status == MRSP_WAIT_FOR_OWNERSHIP ) {
     
    201202    rival->status = MRSP_TIMEOUT;
    202203
    203     _MRSP_Release( mrsp, &lock_context );
     204    _MRSP_Release( mrsp, &queue_context );
    204205  } else {
    205     _MRSP_Release( mrsp, &lock_context );
     206    _MRSP_Release( mrsp, &queue_context );
    206207  }
    207208}
    208209
    209210RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Wait_for_ownership(
    210   MRSP_Control      *mrsp,
    211   Resource_Node     *owner,
    212   Thread_Control    *executing,
    213   Priority_Control   initial_priority,
    214   Priority_Control   ceiling_priority,
    215   Watchdog_Interval  timeout,
    216   ISR_lock_Context  *lock_context
     211  MRSP_Control         *mrsp,
     212  Resource_Node        *owner,
     213  Thread_Control       *executing,
     214  Priority_Control      initial_priority,
     215  Priority_Control      ceiling_priority,
     216  Watchdog_Interval     timeout,
     217  Thread_queue_Context *queue_context
    217218)
    218219{
     
    244245  _MRSP_Giant_release( &giant_lock_context );
    245246
    246   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    247   _MRSP_Release( mrsp, lock_context );
     247  cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     248  _MRSP_Release( mrsp, queue_context );
    248249
    249250  _Thread_Raise_priority( executing, ceiling_priority );
     
    287288
    288289RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Seize(
    289   MRSP_Control      *mrsp,
    290   Thread_Control    *executing,
    291   bool               wait,
    292   Watchdog_Interval  timeout,
    293   ISR_lock_Context  *lock_context
     290  MRSP_Control         *mrsp,
     291  Thread_Control       *executing,
     292  bool                  wait,
     293  Watchdog_Interval     timeout,
     294  Thread_queue_Context *queue_context
    294295)
    295296{
     
    307308
    308309  if ( !priority_ok) {
    309     _ISR_lock_ISR_enable( lock_context );
     310    _ISR_lock_ISR_enable( &queue_context->Lock_context );
    310311    return MRSP_INVALID_PRIORITY;
    311312  }
    312313
    313   _MRSP_Acquire_critical( mrsp, lock_context );
     314  _MRSP_Acquire_critical( mrsp, queue_context );
    314315  owner = _Resource_Get_owner( &mrsp->Resource );
    315316  if ( owner == NULL ) {
     
    319320      initial_priority,
    320321      ceiling_priority,
    321       lock_context
     322      queue_context
    322323    );
    323324    status = MRSP_SUCCESSFUL;
     
    333334      ceiling_priority,
    334335      timeout,
    335       lock_context
     336      queue_context
    336337    );
    337338  } else {
    338     _MRSP_Release( mrsp, lock_context );
     339    _MRSP_Release( mrsp, queue_context );
    339340    /* Not available, nested access or deadlock */
    340341    status = MRSP_UNSATISFIED;
     
    345346
    346347RTEMS_INLINE_ROUTINE MRSP_Status _MRSP_Surrender(
    347   MRSP_Control     *mrsp,
    348   Thread_Control   *executing,
    349   ISR_lock_Context *lock_context
     348  MRSP_Control         *mrsp,
     349  Thread_Control       *executing,
     350  Thread_queue_Context *queue_context
    350351)
    351352{
     
    355356
    356357  if ( _Resource_Get_owner( &mrsp->Resource ) != &executing->Resource_node ) {
    357     _ISR_lock_ISR_enable( lock_context );
     358    _ISR_lock_ISR_enable( &queue_context->Lock_context );
    358359    return MRSP_NOT_OWNER_OF_RESOURCE;
    359360  }
     
    365366    )
    366367  ) {
    367     _ISR_lock_ISR_enable( lock_context );
     368    _ISR_lock_ISR_enable( &queue_context->Lock_context );
    368369    return MRSP_INCORRECT_STATE;
    369370  }
     
    371372  initial_priority = mrsp->initial_priority_of_owner;
    372373
    373   _MRSP_Acquire_critical( mrsp, lock_context );
     374  _MRSP_Acquire_critical( mrsp, queue_context );
    374375
    375376  _MRSP_Giant_acquire( &giant_lock_context );
     
    406407  _MRSP_Giant_release( &giant_lock_context );
    407408
    408   cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    409   _MRSP_Release( mrsp, lock_context );
     409  cpu_self = _Thread_Dispatch_disable_critical( &queue_context->Lock_context );
     410  _MRSP_Release( mrsp, queue_context );
    410411
    411412  _MRSP_Restore_priority( executing, initial_priority );
     
    426427
    427428RTEMS_INLINE_ROUTINE void _MRSP_Destroy(
    428   MRSP_Control     *mrsp,
    429   ISR_lock_Context *lock_context
    430 )
    431 {
    432   _MRSP_Release( mrsp, lock_context );
     429  MRSP_Control         *mrsp,
     430  Thread_queue_Context *queue_context
     431)
     432{
     433  _MRSP_Release( mrsp, queue_context );
    433434  _ISR_lock_Destroy( &mrsp->Lock );
    434435  _Workspace_Free( mrsp->ceiling_priorities );
  • cpukit/score/include/rtems/score/threadq.h

    rc3d8d9e r631b3c8  
    5757);
    5858#endif
     59
     60/**
     61 * @brief Thread queue context for the thread queue methods.
     62 *
     63 * @see _Thread_queue_Context_initialize().
     64 */
     65typedef struct {
     66  ISR_lock_Context Lock_context;
     67#if defined(RTEMS_MULTIPROCESSING)
     68  Thread_queue_MP_callout mp_callout;
     69#endif
     70} Thread_queue_Context;
    5971
    6072/**
  • cpukit/score/include/rtems/score/threadqimpl.h

    rc3d8d9e r631b3c8  
    5353#endif
    5454} Thread_queue_Syslock_queue;
     55
     56RTEMS_INLINE_ROUTINE void _Thread_queue_Do_context_initialize(
     57  Thread_queue_Context    *queue_context
     58#if defined(RTEMS_MULTIPROCESSING)
     59  ,
     60  Thread_queue_MP_callout  mp_callout
     61#endif
     62)
     63{
     64#if defined(RTEMS_MULTIPROCESSING)
     65  queue_context->mp_callout = mp_callout;
     66#else
     67  (void) queue_context;
     68#endif
     69}
     70
     71/**
     72 * @brief Initializes a thread queue context.
     73 *
     74 * @param queue_context The thread queue context to initialize.
     75 * @param mp_callout Callout to unblock the thread in case it is actually a
     76 *   thread proxy.  This parameter is only used on multiprocessing
     77 *   configurations.  Used by thread queue extract and unblock methods for
     78 *   objects with multiprocessing (MP) support.
     79 */
     80#if defined(RTEMS_MULTIPROCESSING)
     81  #define _Thread_queue_Context_initialize( \
     82    queue_context, \
     83    mp_callout \
     84  ) \
     85    _Thread_queue_Do_context_initialize( \
     86      queue_context, \
     87      mp_callout \
     88    )
     89#else
     90  #define _Thread_queue_Context_initialize( \
     91    queue_context, \
     92    mp_callout \
     93  ) \
     94    _Thread_queue_Do_context_initialize( \
     95      queue_context \
     96    )
     97#endif
    5598
    5699RTEMS_INLINE_ROUTINE void _Thread_queue_Heads_initialize(
     
    345388#if defined(RTEMS_MULTIPROCESSING)
    346389  ,
    347   Thread_queue_MP_callout        mp_callout
     390  const Thread_queue_Context    *queue_context
    348391#endif
    349392);
     
    359402 * @param[in] operations The thread queue operations.
    360403 * @param[in] the_thread The thread to extract.
    361  * @param[in] mp_callout Callout to unblock the thread in case it is actually a
    362  *   thread proxy.  This parameter is only used on multiprocessing
    363  *   configurations.
     404 * @param[in] queue_context The thread queue context.  This parameter is only
     405 *   used on multiprocessing configurations.
    364406 *
    365407 * @return Returns the unblock indicator for _Thread_queue_Unblock_critical().
     
    376418    queue, \
    377419    the_thread, \
    378     mp_callout \
     420    queue_context \
    379421  ) \
    380422    _Thread_queue_Do_extract_locked( \
     
    382424      queue, \
    383425      the_thread, \
    384       mp_callout \
     426      queue_context \
    385427    )
    386428#else
     
    389431    queue, \
    390432    the_thread, \
    391     mp_callout \
     433    queue_context \
    392434  ) \
    393435    _Thread_queue_Do_extract_locked( \
     
    417459  Thread_Control     *the_thread,
    418460  ISR_lock_Context   *lock_context
    419 );
    420 
    421 void _Thread_queue_Do_extract_critical(
    422   Thread_queue_Queue            *queue,
    423   const Thread_queue_Operations *operations,
    424   Thread_Control                *the_thread,
    425 #if defined(RTEMS_MULTIPROCESSING)
    426   Thread_queue_MP_callout        mp_callout,
    427 #endif
    428   ISR_lock_Context              *lock_context
    429461);
    430462
     
    451483 * void _Mutex_Release( Mutex *mutex )
    452484 * {
    453  *   ISR_lock_Context  lock_context;
    454  *   Thread_Control   *first;
    455  *
    456  *   _Thread_queue_Acquire( &mutex->Queue, &lock_context );
     485 *   Thread_queue_Context  queue_context;
     486 *   Thread_Control       *first;
     487 *
     488 *   _Thread_queue_Context_initialize( &queue_context, NULL );
     489 *   _Thread_queue_Acquire( &mutex->Queue, &queue_context.Lock_context );
    457490 *
    458491 *   first = _Thread_queue_First_locked( &mutex->Queue );
     
    464497 *       mutex->Queue.operations,
    465498 *       first,
    466  *       NULL,
    467  *       0,
    468  *       &lock_context
     499 *       &queue_context
    469500 *   );
    470501 * }
     
    474505 * @param[in] operations The thread queue operations.
    475506 * @param[in] the_thread The thread to extract.
    476  * @param[in] mp_callout Callout to unblock the thread in case it is actually a
    477  *   thread proxy.  This parameter is only used on multiprocessing
    478  *   configurations.
    479  * @param[in] lock_context The lock context of the lock acquire.
    480  */
    481 #if defined(RTEMS_MULTIPROCESSING)
    482   #define _Thread_queue_Extract_critical( \
    483     queue, \
    484     operations, \
    485     the_thread, \
    486     mp_callout, \
    487     lock_context \
    488   ) \
    489     _Thread_queue_Do_extract_critical( \
    490       queue, \
    491       operations, \
    492       the_thread, \
    493       mp_callout, \
    494       lock_context \
    495     )
    496 #else
    497   #define _Thread_queue_Extract_critical( \
    498     queue, \
    499     operations, \
    500     the_thread, \
    501     mp_callout, \
    502     lock_context \
    503   ) \
    504     _Thread_queue_Do_extract_critical( \
    505       queue, \
    506       operations, \
    507       the_thread, \
    508       lock_context \
    509     )
    510 #endif
     507 * @param[in] queue_context The thread queue context of the lock acquire.
     508 */
     509void _Thread_queue_Extract_critical(
     510  Thread_queue_Queue            *queue,
     511  const Thread_queue_Operations *operations,
     512  Thread_Control                *the_thread,
     513  Thread_queue_Context          *queue_context
     514);
    511515
    512516/**
     
    593597 *   parameter and the return value.
    594598 * @param queue The actual thread queue.
    595  * @param lock_context The lock context of the lock acquire.  May be used to
    596  *   pass additional data to the filter function via an overlay structure.  The
    597  *   filter function should not release or acquire the thread queue lock.
     599 * @param queue_context The thread queue context of the lock acquire.  May be
     600 *   used to pass additional data to the filter function via an overlay
     601 *   structure.  The filter function should not release or acquire the thread
     602 *   queue lock.
    598603 *
    599604 * @retval the_thread Extract this thread.
     
    603608 */
    604609typedef Thread_Control *( *Thread_queue_Flush_filter )(
    605   Thread_Control     *the_thread,
    606   Thread_queue_Queue *queue,
    607   ISR_lock_Context   *lock_context
     610  Thread_Control       *the_thread,
     611  Thread_queue_Queue   *queue,
     612  Thread_queue_Context *queue_context
    608613);
    609614
     
    613618 * @param the_thread The thread to extract.
    614619 * @param queue Unused.
    615  * @param lock_context Unused.
     620 * @param queue_context Unused.
    616621 *
    617622 * @retval the_thread Extract this thread.
    618623 */
    619624Thread_Control *_Thread_queue_Flush_default_filter(
    620   Thread_Control     *the_thread,
    621   Thread_queue_Queue *queue,
    622   ISR_lock_Context   *lock_context
    623 );
    624 
    625 size_t _Thread_queue_Do_flush_critical(
    626   Thread_queue_Queue            *queue,
    627   const Thread_queue_Operations *operations,
    628   Thread_queue_Flush_filter      filter,
    629 #if defined(RTEMS_MULTIPROCESSING)
    630   Thread_queue_MP_callout        mp_callout,
    631 #endif
    632   ISR_lock_Context              *lock_context
     625  Thread_Control       *the_thread,
     626  Thread_queue_Queue   *queue,
     627  Thread_queue_Context *queue_context
    633628);
    634629
     
    648643 *   The return value of the filter function controls if the thread queue flush
    649644 *   operation should stop or continue.
    650  * @param mp_callout Callout to extract the proxy of a remote thread.  This
    651  *   parameter is only used on multiprocessing configurations.
     645 * @param queue_context The thread queue context of the lock acquire.  May be
     646 *   used to pass additional data to the filter function via an overlay
     647 *   structure.  The filter function should not release or acquire the thread
     648 *   queue lock.
    652649 *
    653650 * @return The count of extracted threads.
    654651 */
    655 #if defined(RTEMS_MULTIPROCESSING)
    656   #define _Thread_queue_Flush_critical( \
    657     queue, \
    658     operations, \
    659     filter, \
    660     mp_callout, \
    661     lock_context \
    662   ) \
    663     _Thread_queue_Do_flush_critical( \
    664       queue, \
    665       operations, \
    666       filter, \
    667       mp_callout, \
    668       lock_context \
    669     )
    670 #else
    671   #define _Thread_queue_Flush_critical( \
    672     queue, \
    673     operations, \
    674     filter, \
    675     mp_callout, \
    676     lock_context \
    677   ) \
    678     _Thread_queue_Do_flush_critical( \
    679       queue, \
    680       operations, \
    681       filter, \
    682       lock_context \
    683     )
    684 #endif
     652size_t _Thread_queue_Flush_critical(
     653  Thread_queue_Queue            *queue,
     654  const Thread_queue_Operations *operations,
     655  Thread_queue_Flush_filter      filter,
     656  Thread_queue_Context          *queue_context
     657);
    685658
    686659void _Thread_queue_Initialize( Thread_queue_Control *the_thread_queue );
  • cpukit/score/src/apimutexlock.c

    rc3d8d9e r631b3c8  
    2626void _API_Mutex_Lock( API_Mutex_Control *the_mutex )
    2727{
    28   Thread_Life_state previous_thread_life_state;
    29   ISR_lock_Context  lock_context;
     28  Thread_Life_state    previous_thread_life_state;
     29  Thread_queue_Context queue_context;
    3030
    3131  previous_thread_life_state =
    3232    _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
    3333
    34   _ISR_lock_ISR_disable( &lock_context );
     34  _Thread_queue_Context_initialize( &queue_context, NULL );
     35  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    3536
    3637  _CORE_mutex_Seize(
     
    3940    true,
    4041    0,
    41     &lock_context
     42    &queue_context
    4243  );
    4344
  • cpukit/score/src/apimutexunlock.c

    rc3d8d9e r631b3c8  
    2525void _API_Mutex_Unlock( API_Mutex_Control *the_mutex )
    2626{
    27   ISR_lock_Context  lock_context;
    28   Thread_Life_state previous_thread_life_state;
    29   bool              restore_thread_life_protection;
     27  Thread_queue_Context queue_context;
     28  Thread_Life_state    previous_thread_life_state;
     29  bool                 restore_thread_life_protection;
    3030
    3131  previous_thread_life_state = the_mutex->previous_thread_life_state;
    3232  restore_thread_life_protection = the_mutex->Mutex.nest_count == 1;
    3333
    34   _ISR_lock_ISR_disable( &lock_context );
    35   _CORE_mutex_Surrender(
    36     &the_mutex->Mutex,
    37     NULL,
    38     &lock_context
    39   );
     34  _Thread_queue_Context_initialize( &queue_context, NULL );
     35  _ISR_lock_ISR_disable( &queue_context.Lock_context );
     36  _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
    4037
    4138  if ( restore_thread_life_protection ) {
  • cpukit/score/src/condition.c

    rc3d8d9e r631b3c8  
    221221
    222222typedef struct {
    223   ISR_lock_Context Base;
    224   int              count;
    225 } Condition_Lock_context;
     223  Thread_queue_Context Base;
     224  int                  count;
     225} Condition_Context;
    226226
    227227static Thread_Control *_Condition_Flush_filter(
    228   Thread_Control     *the_thread,
    229   Thread_queue_Queue *queue,
    230   ISR_lock_Context   *lock_context
    231 )
    232 {
    233   Condition_Lock_context *condition_lock_context;
    234 
    235   condition_lock_context = (Condition_Lock_context *) lock_context;
    236 
    237   if ( condition_lock_context->count <= 0 ) {
     228  Thread_Control       *the_thread,
     229  Thread_queue_Queue   *queue,
     230  Thread_queue_Context *queue_context
     231)
     232{
     233  Condition_Context *context;
     234
     235  context = (Condition_Context *) queue_context;
     236
     237  if ( context->count <= 0 ) {
    238238    return NULL;
    239239  }
    240240
    241   --condition_lock_context->count;
     241  --context->count;
    242242
    243243  return the_thread;
     
    246246static void _Condition_Wake( struct _Condition_Control *_condition, int count )
    247247{
    248   Condition_Control      *condition;
    249   Condition_Lock_context  lock_context;
     248  Condition_Control *condition;
     249  Condition_Context  context;
    250250
    251251  condition = _Condition_Get( _condition );
    252   _ISR_lock_ISR_disable( &lock_context.Base );
    253   _Condition_Queue_acquire_critical( condition, &lock_context.Base );
     252  _Thread_queue_Context_initialize( &context.Base, NULL );
     253  _ISR_lock_ISR_disable( &context.Base.Lock_context );
     254  _Condition_Queue_acquire_critical( condition, &context.Base.Lock_context );
    254255
    255256  /*
     
    258259   */
    259260  if ( __predict_true( _Thread_queue_Is_empty( &condition->Queue.Queue ) ) ) {
    260     _Condition_Queue_release( condition, &lock_context.Base );
     261    _Condition_Queue_release( condition, &context.Base.Lock_context );
    261262    return;
    262263  }
    263264
    264   lock_context.count = count;
     265  context.count = count;
    265266  _Thread_queue_Flush_critical(
    266267    &condition->Queue.Queue,
    267268    CONDITION_TQ_OPERATIONS,
    268269    _Condition_Flush_filter,
    269     NULL,
    270     &lock_context.Base
     270    &context.Base
    271271  );
    272272}
  • cpukit/score/src/corebarrier.c

    rc3d8d9e r631b3c8  
    3434
    3535Thread_Control *_CORE_barrier_Was_deleted(
    36   Thread_Control     *the_thread,
    37   Thread_queue_Queue *queue,
    38   ISR_lock_Context   *lock_context
     36  Thread_Control       *the_thread,
     37  Thread_queue_Queue   *queue,
     38  Thread_queue_Context *queue_context
    3939)
    4040{
  • cpukit/score/src/corebarrierrelease.c

    rc3d8d9e r631b3c8  
    2222#include <rtems/score/corebarrierimpl.h>
    2323
    24 uint32_t _CORE_barrier_Do_surrender(
     24uint32_t _CORE_barrier_Do_flush(
    2525  CORE_barrier_Control      *the_barrier,
    2626  Thread_queue_Flush_filter  filter,
    27 #if defined(RTEMS_MULTIPROCESSING)
    28   Thread_queue_MP_callout    mp_callout,
    29 #endif
    30   ISR_lock_Context          *lock_context
     27  Thread_queue_Context      *queue_context
    3128)
    3229{
     
    3633    CORE_BARRIER_TQ_OPERATIONS,
    3734    filter,
    38     mp_callout,
    39     lock_context
     35    queue_context
    4036  );
    4137}
  • cpukit/score/src/corebarrierwait.c

    rc3d8d9e r631b3c8  
    2222#include <rtems/score/statesimpl.h>
    2323
    24 void _CORE_barrier_Do_seize(
    25   CORE_barrier_Control    *the_barrier,
    26   Thread_Control          *executing,
    27   bool                     wait,
    28   Watchdog_Interval        timeout,
    29 #if defined(RTEMS_MULTIPROCESSING)
    30   Thread_queue_MP_callout  mp_callout,
    31 #endif
    32   ISR_lock_Context        *lock_context
     24void _CORE_barrier_Seize(
     25  CORE_barrier_Control *the_barrier,
     26  Thread_Control       *executing,
     27  bool                  wait,
     28  Watchdog_Interval     timeout,
     29  Thread_queue_Context *queue_context
    3330)
    3431{
     
    3734  executing->Wait.return_code = CORE_BARRIER_STATUS_SUCCESSFUL;
    3835
    39   _CORE_barrier_Acquire_critical( the_barrier, lock_context );
     36  _CORE_barrier_Acquire_critical( the_barrier, queue_context );
    4037
    4138  number_of_waiting_threads = the_barrier->number_of_waiting_threads;
     
    4744  ) {
    4845    executing->Wait.return_code = CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED;
    49     _CORE_barrier_Surrender( the_barrier, mp_callout, lock_context );
     46    _CORE_barrier_Surrender( the_barrier, queue_context );
    5047  } else {
    5148    the_barrier->number_of_waiting_threads = number_of_waiting_threads;
     
    5754      timeout,
    5855      CORE_BARRIER_TIMEOUT,
    59       lock_context
     56      &queue_context->Lock_context
    6057    );
    6158  }
  • cpukit/score/src/coremsgbroadcast.c

    rc3d8d9e r631b3c8  
    2222#include <rtems/score/objectimpl.h>
    2323
    24 CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
     24CORE_message_queue_Status _CORE_message_queue_Broadcast(
    2525  CORE_message_queue_Control *the_message_queue,
    2626  const void                 *buffer,
    2727  size_t                      size,
    28 #if defined(RTEMS_MULTIPROCESSING)
    29   Thread_queue_MP_callout     mp_callout,
    30 #endif
    3128  uint32_t                   *count,
    32   ISR_lock_Context           *lock_context
     29  Thread_queue_Context       *queue_context
    3330)
    3431{
     
    3734
    3835  if ( size > the_message_queue->maximum_message_size ) {
    39     _ISR_lock_ISR_enable( lock_context );
     36    _ISR_lock_ISR_enable( &queue_context->Lock_context );
    4037    return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
    4138  }
     
    4340  number_broadcasted = 0;
    4441
    45   _CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
     42  _CORE_message_queue_Acquire_critical( the_message_queue, queue_context );
    4643
    4744  while (
     
    5148        buffer,
    5249        size,
    53         mp_callout,
    5450        0,
    55         lock_context
     51        queue_context
    5652      )
    5753    )
     
    5955    number_broadcasted += 1;
    6056
    61     _CORE_message_queue_Acquire( the_message_queue, lock_context );
     57    _CORE_message_queue_Acquire( the_message_queue, queue_context );
    6258  }
    6359
    64   _CORE_message_queue_Release( the_message_queue, lock_context );
     60  _CORE_message_queue_Release( the_message_queue, queue_context );
    6561
    6662  *count = number_broadcasted;
  • cpukit/score/src/coremsgclose.c

    rc3d8d9e r631b3c8  
    2323
    2424static Thread_Control *_CORE_message_queue_Was_deleted(
    25   Thread_Control     *the_thread,
    26   Thread_queue_Queue *queue,
    27   ISR_lock_Context   *lock_context
     25  Thread_Control       *the_thread,
     26  Thread_queue_Queue   *queue,
     27  Thread_queue_Context *queue_context
    2828)
    2929{
     
    3333}
    3434
    35 void _CORE_message_queue_Do_close(
     35void _CORE_message_queue_Close(
    3636  CORE_message_queue_Control *the_message_queue,
    37 #if defined(RTEMS_MULTIPROCESSING)
    38   Thread_queue_MP_callout     mp_callout,
    39 #endif
    40   ISR_lock_Context           *lock_context
     37  Thread_queue_Context       *queue_context
    4138)
    4239{
     
    5148    the_message_queue->operations,
    5249    _CORE_message_queue_Was_deleted,
    53     mp_callout,
    54     lock_context
     50    queue_context
    5551  );
    5652
  • cpukit/score/src/coremsgflush.c

    rc3d8d9e r631b3c8  
    2424uint32_t   _CORE_message_queue_Flush(
    2525  CORE_message_queue_Control *the_message_queue,
    26   ISR_lock_Context           *lock_context
     26  Thread_queue_Context       *queue_context
    2727)
    2828{
     
    6060   */
    6161
    62   _CORE_message_queue_Acquire_critical( the_message_queue, lock_context );
     62  _CORE_message_queue_Acquire_critical( the_message_queue, queue_context );
    6363
    6464  count = the_message_queue->number_of_pending_messages;
     
    7979  }
    8080
    81   _CORE_message_queue_Release( the_message_queue, lock_context );
     81  _CORE_message_queue_Release( the_message_queue, queue_context );
    8282  return count;
    8383}
  • cpukit/score/src/coremsgseize.c

    rc3d8d9e r631b3c8  
    2525#include <rtems/score/thread.h>
    2626#include <rtems/score/statesimpl.h>
    27 #include <rtems/score/wkspace.h>
    2827
    2928void _CORE_message_queue_Seize(
     
    3433  bool                        wait,
    3534  Watchdog_Interval           timeout,
    36   ISR_lock_Context           *lock_context
     35  Thread_queue_Context       *queue_context
    3736)
    3837{
     
    5958       */
    6059      _CORE_message_queue_Free_message_buffer(the_message_queue, the_message);
    61       _CORE_message_queue_Release( the_message_queue, lock_context );
     60      _CORE_message_queue_Release( the_message_queue, queue_context );
    6261      return;
    6362    #else
     
    8180          the_message
    8281        );
    83         _CORE_message_queue_Release( the_message_queue, lock_context );
     82        _CORE_message_queue_Release( the_message_queue, queue_context );
    8483        return;
    8584      }
     
    101100        the_message_queue->operations,
    102101        the_thread,
    103         NULL,
    104         lock_context
     102        queue_context
    105103      );
    106104      return;
     
    110108
    111109  if ( !wait ) {
    112     _CORE_message_queue_Release( the_message_queue, lock_context );
     110    _CORE_message_queue_Release( the_message_queue, queue_context );
    113111    executing->Wait.return_code = CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT;
    114112    return;
     
    126124    timeout,
    127125    CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
    128     lock_context
     126    &queue_context->Lock_context
    129127  );
    130128}
  • cpukit/score/src/coremsgsubmit.c

    rc3d8d9e r631b3c8  
    2626#include <rtems/score/wkspace.h>
    2727
    28 CORE_message_queue_Status _CORE_message_queue_Do_submit(
     28CORE_message_queue_Status _CORE_message_queue_Submit(
    2929  CORE_message_queue_Control       *the_message_queue,
    3030  Thread_Control                   *executing,
    3131  const void                       *buffer,
    3232  size_t                            size,
    33 #if defined(RTEMS_MULTIPROCESSING)
    34   Thread_queue_MP_callout           mp_callout,
    35 #endif
    3633  CORE_message_queue_Submit_types   submit_type,
    3734  bool                              wait,
    3835  Watchdog_Interval                 timeout,
    39   ISR_lock_Context                 *lock_context
     36  Thread_queue_Context             *queue_context
    4037)
    4138{
     
    4441
    4542  if ( size > the_message_queue->maximum_message_size ) {
    46     _CORE_message_queue_Release( the_message_queue, lock_context );
     43    _CORE_message_queue_Release( the_message_queue, queue_context );
    4744    return CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE;
    4845  }
     
    5653    buffer,
    5754    size,
    58     mp_callout,
    5955    submit_type,
    60     lock_context
     56    queue_context
    6157  );
    6258  if ( the_thread != NULL ) {
     
    9187      ( *the_message_queue->notify_handler )(
    9288        the_message_queue,
    93         lock_context
     89        queue_context
    9490      );
    9591    } else {
    96       _CORE_message_queue_Release( the_message_queue, lock_context );
     92      _CORE_message_queue_Release( the_message_queue, queue_context );
    9793    }
    9894#else
    99     _CORE_message_queue_Release( the_message_queue, lock_context );
     95    _CORE_message_queue_Release( the_message_queue, queue_context );
    10096#endif
    10197
     
    104100
    105101  #if !defined(RTEMS_SCORE_COREMSG_ENABLE_BLOCKING_SEND)
    106     _CORE_message_queue_Release( the_message_queue, lock_context );
     102    _CORE_message_queue_Release( the_message_queue, queue_context );
    107103    return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
    108104  #else
     
    113109     */
    114110    if ( !wait ) {
    115       _CORE_message_queue_Release( the_message_queue, lock_context );
     111      _CORE_message_queue_Release( the_message_queue, queue_context );
    116112      return CORE_MESSAGE_QUEUE_STATUS_TOO_MANY;
    117113    }
     
    122118     */
    123119    if ( _ISR_Is_in_progress() ) {
    124       _CORE_message_queue_Release( the_message_queue, lock_context );
     120      _CORE_message_queue_Release( the_message_queue, queue_context );
    125121      return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED;
    126122    }
     
    144140      timeout,
    145141      CORE_MESSAGE_QUEUE_STATUS_TIMEOUT,
    146       lock_context
     142      &queue_context->Lock_context
    147143    );
    148144    return executing->Wait.return_code;
  • cpukit/score/src/coremutex.c

    rc3d8d9e r631b3c8  
    9393
    9494Thread_Control *_CORE_mutex_Was_deleted(
    95   Thread_Control     *the_thread,
    96   Thread_queue_Queue *queue,
    97   ISR_lock_Context   *lock_context
     95  Thread_Control       *the_thread,
     96  Thread_queue_Queue   *queue,
     97  Thread_queue_Context *queue_context
    9898)
    9999{
     
    104104
    105105Thread_Control *_CORE_mutex_Unsatisfied_nowait(
    106   Thread_Control     *the_thread,
    107   Thread_queue_Queue *queue,
    108   ISR_lock_Context   *lock_context
     106  Thread_Control       *the_thread,
     107  Thread_queue_Queue   *queue,
     108  Thread_queue_Context *queue_context
    109109)
    110110{
  • cpukit/score/src/coremutexsurrender.c

    rc3d8d9e r631b3c8  
    2424#include <rtems/score/thread.h>
    2525
    26 CORE_mutex_Status _CORE_mutex_Do_surrender(
    27   CORE_mutex_Control      *the_mutex,
    28 #if defined(RTEMS_MULTIPROCESSING)
    29   Thread_queue_MP_callout  mp_callout,
    30 #endif
    31   ISR_lock_Context        *lock_context
     26CORE_mutex_Status _CORE_mutex_Surrender(
     27  CORE_mutex_Control   *the_mutex,
     28  Thread_queue_Context *queue_context
    3229)
    3330{
     
    4744  if ( the_mutex->Attributes.only_owner_release ) {
    4845    if ( !_Thread_Is_executing( holder ) ) {
    49       _ISR_lock_ISR_enable( lock_context );
     46      _ISR_lock_ISR_enable( &queue_context->Lock_context );
    5047      return CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE;
    5148    }
    5249  }
    5350
    54   _Thread_queue_Acquire_critical( &the_mutex->Wait_queue, lock_context );
     51  _CORE_mutex_Acquire_critical( the_mutex, queue_context );
    5552
    5653  /* XXX already unlocked -- not right status */
    5754
    5855  if ( !the_mutex->nest_count ) {
    59     _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     56    _CORE_mutex_Release( the_mutex, queue_context );
    6057    return CORE_MUTEX_STATUS_SUCCESSFUL;
    6158  }
     
    7269      switch ( the_mutex->Attributes.lock_nesting_behavior ) {
    7370        case CORE_MUTEX_NESTING_ACQUIRES:
    74           _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     71          _CORE_mutex_Release( the_mutex, queue_context );
    7572          return CORE_MUTEX_STATUS_SUCCESSFUL;
    7673        #if defined(RTEMS_POSIX_API)
    7774          case CORE_MUTEX_NESTING_IS_ERROR:
    7875            /* should never occur */
    79             _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     76            _CORE_mutex_Release( the_mutex, queue_context );
    8077            return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
    8178        #endif
     
    8582      }
    8683    #else
    87       _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     84      _CORE_mutex_Release( the_mutex, queue_context );
    8885      /* must be CORE_MUTEX_NESTING_ACQUIRES or we wouldn't be here */
    8986      return CORE_MUTEX_STATUS_SUCCESSFUL;
     
    127124      the_mutex->operations,
    128125      the_thread,
    129       mp_callout
     126      queue_context
    130127    );
    131128
     
    156153      &the_mutex->Wait_queue.Queue,
    157154      the_thread,
    158       lock_context
     155      &queue_context->Lock_context
    159156    );
    160157  } else {
    161     _Thread_queue_Release( &the_mutex->Wait_queue, lock_context );
     158    _CORE_mutex_Release( the_mutex, queue_context );
    162159  }
    163160
  • cpukit/score/src/corerwlockobtainread.c

    rc3d8d9e r631b3c8  
    2525
    2626void _CORE_RWLock_Seize_for_reading(
    27   CORE_RWLock_Control *the_rwlock,
    28   Thread_Control      *executing,
    29   bool                 wait,
    30   Watchdog_Interval    timeout,
    31   ISR_lock_Context    *lock_context
     27  CORE_RWLock_Control  *the_rwlock,
     28  Thread_Control       *executing,
     29  bool                  wait,
     30  Watchdog_Interval     timeout,
     31  Thread_queue_Context *queue_context
    3232)
    3333{
     
    3838   */
    3939
    40   _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
     40  _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
    4141
    4242  switch ( the_rwlock->current_state ) {
     
    4444      the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_READING;
    4545      the_rwlock->number_of_readers += 1;
    46       _CORE_RWLock_Release( the_rwlock, lock_context );
     46      _CORE_RWLock_Release( the_rwlock, queue_context );
    4747      executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
    4848      return;
     
    5656      if ( !waiter ) {
    5757        the_rwlock->number_of_readers += 1;
    58         _CORE_RWLock_Release( the_rwlock, lock_context );
     58        _CORE_RWLock_Release( the_rwlock, queue_context );
    5959        executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
    6060        return;
     
    7171
    7272  if ( !wait ) {
    73     _CORE_RWLock_Release( the_rwlock, lock_context );
     73    _CORE_RWLock_Release( the_rwlock, queue_context );
    7474    executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
    7575    return;
     
    9090     timeout,
    9191     CORE_RWLOCK_TIMEOUT,
    92      lock_context
     92     &queue_context->Lock_context
    9393  );
    9494}
  • cpukit/score/src/corerwlockobtainwrite.c

    rc3d8d9e r631b3c8  
    2525
    2626void _CORE_RWLock_Seize_for_writing(
    27   CORE_RWLock_Control *the_rwlock,
    28   Thread_Control      *executing,
    29   bool                 wait,
    30   Watchdog_Interval    timeout,
    31   ISR_lock_Context    *lock_context
     27  CORE_RWLock_Control  *the_rwlock,
     28  Thread_Control       *executing,
     29  bool                  wait,
     30  Watchdog_Interval     timeout,
     31  Thread_queue_Context *queue_context
    3232)
    3333{
     
    3939   */
    4040
    41   _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
     41  _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
    4242
    4343  switch ( the_rwlock->current_state ) {
    4444    case CORE_RWLOCK_UNLOCKED:
    4545      the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING;
    46       _CORE_RWLock_Release( the_rwlock, lock_context );
     46      _CORE_RWLock_Release( the_rwlock, queue_context );
    4747      executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
    4848      return;
     
    5858
    5959  if ( !wait ) {
    60     _CORE_RWLock_Release( the_rwlock, lock_context );
     60    _CORE_RWLock_Release( the_rwlock, queue_context );
    6161    executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
    6262    return;
     
    7777     timeout,
    7878     CORE_RWLOCK_TIMEOUT,
    79      lock_context
     79     &queue_context->Lock_context
    8080  );
    8181}
  • cpukit/score/src/corerwlockrelease.c

    rc3d8d9e r631b3c8  
    3636
    3737static Thread_Control *_CORE_RWLock_Flush_filter(
    38   Thread_Control     *the_thread,
    39   Thread_queue_Queue *queue,
    40   ISR_lock_Context   *lock_context
     38  Thread_Control       *the_thread,
     39  Thread_queue_Queue   *queue,
     40  Thread_queue_Context *queue_context
    4141)
    4242{
     
    7575
    7676CORE_RWLock_Status _CORE_RWLock_Surrender(
    77   CORE_RWLock_Control *the_rwlock,
    78   ISR_lock_Context    *lock_context
     77  CORE_RWLock_Control  *the_rwlock,
     78  Thread_queue_Context *queue_context
    7979)
    8080{
     
    8686   */
    8787
    88   _CORE_RWLock_Acquire_critical( the_rwlock, lock_context );
     88  _CORE_RWLock_Acquire_critical( the_rwlock, queue_context );
    8989
    9090  if ( the_rwlock->current_state == CORE_RWLOCK_UNLOCKED){
    9191    /* This is an error at the caller site */
    92     _CORE_RWLock_Release( the_rwlock, lock_context );
     92    _CORE_RWLock_Release( the_rwlock, queue_context );
    9393    return CORE_RWLOCK_SUCCESSFUL;
    9494  }
     
    9999    if ( the_rwlock->number_of_readers != 0 ) {
    100100      /* must be unlocked again */
    101       _CORE_RWLock_Release( the_rwlock, lock_context );
     101      _CORE_RWLock_Release( the_rwlock, queue_context );
    102102      return CORE_RWLOCK_SUCCESSFUL;
    103103    }
     
    120120    CORE_RWLOCK_TQ_OPERATIONS,
    121121    _CORE_RWLock_Flush_filter,
    122     NULL,
    123     lock_context
     122    queue_context
    124123  );
    125124  return CORE_RWLOCK_SUCCESSFUL;
  • cpukit/score/src/coresem.c

    rc3d8d9e r631b3c8  
    3939
    4040Thread_Control *_CORE_semaphore_Was_deleted(
    41   Thread_Control     *the_thread,
    42   Thread_queue_Queue *queue,
    43   ISR_lock_Context   *lock_context
     41  Thread_Control       *the_thread,
     42  Thread_queue_Queue   *queue,
     43  Thread_queue_Context *queue_context
    4444)
    4545{
     
    5050
    5151Thread_Control *_CORE_semaphore_Unsatisfied_nowait(
    52   Thread_Control     *the_thread,
    53   Thread_queue_Queue *queue,
    54   ISR_lock_Context   *lock_context
     52  Thread_Control       *the_thread,
     53  Thread_queue_Queue   *queue,
     54  Thread_queue_Context *queue_context
    5555)
    5656{
  • cpukit/score/src/futex.c

    rc3d8d9e r631b3c8  
    105105
    106106typedef struct {
    107   ISR_lock_Context Base;
    108   int              count;
    109 } Futex_Lock_context;
     107  Thread_queue_Context Base;
     108  int                  count;
     109} Futex_Context;
    110110
    111111static Thread_Control *_Futex_Flush_filter(
    112   Thread_Control     *the_thread,
    113   Thread_queue_Queue *queue,
    114   ISR_lock_Context   *lock_context
     112  Thread_Control       *the_thread,
     113  Thread_queue_Queue   *queue,
     114  Thread_queue_Context *queue_context
    115115)
    116116{
    117   Futex_Lock_context *futex_lock_context;
     117  Futex_Context *context;
    118118
    119   futex_lock_context = (Futex_Lock_context *) lock_context;
     119  context = (Futex_Context *) queue_context;
    120120
    121   if ( futex_lock_context->count <= 0 ) {
     121  if ( context->count <= 0 ) {
    122122    return NULL;
    123123  }
    124124
    125   --futex_lock_context->count;
     125  --context->count;
    126126
    127127  return the_thread;
     
    131131{
    132132  Futex_Control      *futex;
    133   Futex_Lock_context  lock_context;
     133  Futex_Context  context;
    134134
    135135  futex = _Futex_Get( _futex );
    136   _Futex_Queue_acquire( futex, &lock_context.Base );
     136  _Futex_Queue_acquire( futex, &context.Base.Lock_context );
    137137
    138138  /*
     
    142142   */
    143143  if ( __predict_true( _Thread_queue_Is_empty( &futex->Queue.Queue ) ) ) {
    144     _Futex_Queue_release( futex, &lock_context.Base );
     144    _Futex_Queue_release( futex, &context.Base.Lock_context );
    145145    return 0;
    146146  }
    147147
    148   lock_context.count = count;
     148  context.count = count;
    149149  return (int) _Thread_queue_Flush_critical(
    150150    &futex->Queue.Queue,
    151151    FUTEX_TQ_OPERATIONS,
    152152    _Futex_Flush_filter,
    153     NULL,
    154     &lock_context.Base
     153    &context.Base
    155154  );
    156155}
  • cpukit/score/src/mpci.c

    rc3d8d9e r631b3c8  
    322322{
    323323
    324   MP_packet_Prefix         *the_packet;
    325   MPCI_Packet_processor     the_function;
    326   Thread_Control           *executing;
    327   ISR_lock_Context          lock_context;
     324  MP_packet_Prefix      *the_packet;
     325  MPCI_Packet_processor  the_function;
     326  Thread_Control        *executing;
     327  Thread_queue_Context   queue_context;
    328328
    329329  executing = _Thread_Get_executing();
     330  _Thread_queue_Context_initialize( &queue_context, NULL );
    330331
    331332  for ( ; ; ) {
     
    333334    executing->receive_packet = NULL;
    334335
    335     _ISR_lock_ISR_disable( &lock_context );
     336    _ISR_lock_ISR_disable( &queue_context.Lock_context );
    336337    _CORE_semaphore_Seize(
    337338      &_MPCI_Semaphore,
     
    339340      true,
    340341      WATCHDOG_NO_TIMEOUT,
    341       &lock_context
     342      &queue_context
    342343    );
    343344
     
    371372void _MPCI_Announce ( void )
    372373{
    373   ISR_lock_Context lock_context;
    374 
    375   _ISR_lock_ISR_disable( &lock_context );
    376   (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, 0, &lock_context );
     374  Thread_queue_Context queue_context;
     375
     376  _ISR_lock_ISR_disable( &queue_context.Lock_context );
     377  (void) _CORE_semaphore_Surrender( &_MPCI_Semaphore, &queue_context );
    377378}
    378379
  • cpukit/score/src/mutex.c

    rc3d8d9e r631b3c8  
    126126
    127127static void _Mutex_Release_slow(
    128   Mutex_Control      *mutex,
    129   Thread_Control     *executing,
    130   Thread_queue_Heads *heads,
    131   bool                keep_priority,
    132   ISR_lock_Context   *lock_context
     128  Mutex_Control        *mutex,
     129  Thread_Control       *executing,
     130  Thread_queue_Heads   *heads,
     131  bool                  keep_priority,
     132  Thread_queue_Context *queue_context
    133133)
    134134{
     
    147147      operations,
    148148      first,
    149       NULL
     149      queue_context
    150150    );
    151151    _Thread_queue_Boost_priority( &mutex->Queue.Queue, first );
     
    154154      &mutex->Queue.Queue,
    155155      first,
    156       lock_context
     156      &queue_context->Lock_context
    157157    );
    158158  } else {
    159     _Mutex_Queue_release( mutex, lock_context);
     159    _Mutex_Queue_release( mutex, &queue_context->Lock_context );
    160160  }
    161161
     
    170170
    171171static void _Mutex_Release_critical(
    172   Mutex_Control *mutex,
    173   Thread_Control *executing,
    174   ISR_lock_Context *lock_context
     172  Mutex_Control        *mutex,
     173  Thread_Control       *executing,
     174  Thread_queue_Context *queue_context
    175175)
    176176{
     
    194194
    195195  if ( __predict_true( heads == NULL && keep_priority ) ) {
    196     _Mutex_Queue_release( mutex, lock_context );
     196    _Mutex_Queue_release( mutex, &queue_context->Lock_context );
    197197  } else {
    198198    _Mutex_Release_slow(
     
    201201      heads,
    202202      keep_priority,
    203       lock_context
     203      queue_context
    204204    );
    205205  }
     
    298298void _Mutex_Release( struct _Mutex_Control *_mutex )
    299299{
    300   Mutex_Control    *mutex;
    301   ISR_lock_Context  lock_context;
    302   Thread_Control   *executing;
     300  Mutex_Control        *mutex;
     301  Thread_queue_Context  queue_context;
     302  Thread_Control       *executing;
    303303
    304304  mutex = _Mutex_Get( _mutex );
    305   executing = _Mutex_Queue_acquire( mutex, &lock_context );
     305  _Thread_queue_Context_initialize( &queue_context, NULL );
     306  executing = _Mutex_Queue_acquire( mutex, &queue_context.Lock_context );
    306307
    307308  _Assert( mutex->owner == executing );
    308309
    309   _Mutex_Release_critical( mutex, executing, &lock_context );
     310  _Mutex_Release_critical( mutex, executing, &queue_context );
    310311}
    311312
     
    427428{
    428429  Mutex_recursive_Control *mutex;
    429   ISR_lock_Context         lock_context;
     430  Thread_queue_Context     queue_context;
    430431  Thread_Control          *executing;
    431432  unsigned int             nest_level;
    432433
    433434  mutex = _Mutex_recursive_Get( _mutex );
    434   executing = _Mutex_Queue_acquire( &mutex->Mutex, &lock_context );
     435  _Thread_queue_Context_initialize( &queue_context, NULL );
     436  executing = _Mutex_Queue_acquire(
     437    &mutex->Mutex,
     438    &queue_context.Lock_context
     439  );
    435440
    436441  _Assert( mutex->Mutex.owner == executing );
     
    439444
    440445  if ( __predict_true( nest_level == 0 ) ) {
    441     _Mutex_Release_critical( &mutex->Mutex, executing, &lock_context );
     446    _Mutex_Release_critical( &mutex->Mutex, executing, &queue_context );
    442447  } else {
    443448    mutex->nest_level = nest_level - 1;
    444449
    445     _Mutex_Queue_release( &mutex->Mutex, &lock_context );
     450    _Mutex_Queue_release( &mutex->Mutex, &queue_context.Lock_context );
    446451  }
    447452}
  • cpukit/score/src/semaphore.c

    rc3d8d9e r631b3c8  
    111111void _Semaphore_Post( struct _Semaphore_Control *_sem )
    112112{
    113   Semaphore_Control  *sem;
    114   ISR_lock_Context    lock_context;
    115   Thread_queue_Heads *heads;
     113  Semaphore_Control    *sem;
     114  Thread_queue_Context  queue_context;
     115  Thread_queue_Heads   *heads;
    116116
    117117  sem = _Semaphore_Get( _sem );
    118   _Semaphore_Queue_acquire( sem, &lock_context );
     118  _Thread_queue_Context_initialize( &queue_context, NULL );
     119  _Semaphore_Queue_acquire( sem, &queue_context.Lock_context );
    119120
    120121  heads = sem->Queue.Queue.heads;
     
    122123    _Assert( sem->count < UINT_MAX );
    123124    ++sem->count;
    124     _Semaphore_Queue_release( sem, &lock_context );
     125    _Semaphore_Queue_release( sem, &queue_context.Lock_context );
    125126  } else {
    126127    const Thread_queue_Operations *operations;
     
    134135      operations,
    135136      first,
    136       NULL,
    137       &lock_context
     137      &queue_context
    138138    );
    139139  }
  • cpukit/score/src/threadqenqueue.c

    rc3d8d9e r631b3c8  
    100100#if defined(RTEMS_MULTIPROCESSING)
    101101  ,
    102   Thread_queue_MP_callout        mp_callout
     102  const Thread_queue_Context    *queue_context
    103103#endif
    104104)
     
    109109#if defined(RTEMS_MULTIPROCESSING)
    110110  if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    111     Thread_Proxy_control *the_proxy;
    112 
     111    Thread_Proxy_control    *the_proxy;
     112    Thread_queue_MP_callout  mp_callout;
     113
     114    the_proxy = (Thread_Proxy_control *) the_thread;
     115    mp_callout = queue_context->mp_callout;
    113116    _Assert( mp_callout != NULL );
    114 
    115     the_proxy = (Thread_Proxy_control *) the_thread;
    116     the_proxy->thread_queue_callout = mp_callout;
     117    the_proxy->thread_queue_callout = queue_context->mp_callout;
    117118  }
    118119#endif
     
    165166}
    166167
    167 void _Thread_queue_Do_extract_critical(
     168void _Thread_queue_Extract_critical(
    168169  Thread_queue_Queue            *queue,
    169170  const Thread_queue_Operations *operations,
    170171  Thread_Control                *the_thread,
    171 #if defined(RTEMS_MULTIPROCESSING)
    172   Thread_queue_MP_callout        mp_callout,
    173 #endif
    174   ISR_lock_Context              *lock_context
     172  Thread_queue_Context          *queue_context
    175173)
    176174{
     
    181179    operations,
    182180    the_thread,
    183     mp_callout
     181    queue_context
    184182  );
    185183
     
    188186    queue,
    189187    the_thread,
    190     lock_context
     188    &queue_context->Lock_context
    191189  );
    192190}
     
    194192void _Thread_queue_Extract( Thread_Control *the_thread )
    195193{
    196   ISR_lock_Context    lock_context;
    197   void               *lock;
    198   Thread_queue_Queue *queue;
    199 
    200   lock = _Thread_Lock_acquire( the_thread, &lock_context );
     194  Thread_queue_Context  queue_context;
     195  void                 *lock;
     196  Thread_queue_Queue   *queue;
     197
     198  _Thread_queue_Context_initialize(
     199    &queue_context,
     200    _Thread_queue_MP_callout_do_nothing
     201  );
     202  lock = _Thread_Lock_acquire( the_thread, &queue_context.Lock_context );
    201203
    202204  queue = the_thread->Wait.queue;
     
    209211      the_thread->Wait.operations,
    210212      the_thread,
    211       _Thread_queue_MP_callout_do_nothing,
    212       &lock_context
     213      &queue_context
    213214    );
    214215  } else {
    215     _Thread_Lock_release( lock, &lock_context );
     216    _Thread_Lock_release( lock, &queue_context.Lock_context );
    216217  }
    217218}
     
    226227)
    227228{
    228   ISR_lock_Context  lock_context;
    229   Thread_Control   *the_thread;
    230 
    231   _Thread_queue_Acquire( the_thread_queue, &lock_context );
     229  Thread_queue_Context  queue_context;
     230  Thread_Control       *the_thread;
     231
     232  _Thread_queue_Context_initialize( &queue_context, mp_callout );
     233  _Thread_queue_Acquire( the_thread_queue, &queue_context.Lock_context );
    232234
    233235  the_thread = _Thread_queue_First_locked( the_thread_queue, operations );
     
    240242      operations,
    241243      the_thread,
    242       mp_callout,
    243       &lock_context
     244      &queue_context
    244245    );
    245246  } else {
    246     _Thread_queue_Release( the_thread_queue, &lock_context );
     247    _Thread_queue_Release( the_thread_queue, &queue_context.Lock_context );
    247248  }
    248249
  • cpukit/score/src/threadqflush.c

    rc3d8d9e r631b3c8  
    2222
    2323Thread_Control *_Thread_queue_Flush_default_filter(
    24   Thread_Control     *the_thread,
    25   Thread_queue_Queue *queue,
    26   ISR_lock_Context   *lock_context
     24  Thread_Control       *the_thread,
     25  Thread_queue_Queue   *queue,
     26  Thread_queue_Context *queue_context
    2727)
    2828{
    2929  (void) queue;
    30   (void) lock_context;
     30  (void) queue_context;
    3131  return the_thread;
    3232}
    3333
    34 size_t _Thread_queue_Do_flush_critical(
     34size_t _Thread_queue_Flush_critical(
    3535  Thread_queue_Queue            *queue,
    3636  const Thread_queue_Operations *operations,
    3737  Thread_queue_Flush_filter      filter,
    38 #if defined(RTEMS_MULTIPROCESSING)
    39   Thread_queue_MP_callout        mp_callout,
    40 #endif
    41   ISR_lock_Context              *lock_context
     38  Thread_queue_Context          *queue_context
    4239)
    4340{
     
    6158
    6259    first = ( *operations->first )( heads );
    63     first = ( *filter )( first, queue, lock_context );
     60    first = ( *filter )( first, queue, queue_context );
    6461    if ( first == NULL ) {
    6562      break;
     
    7067      operations,
    7168      first,
    72       mp_callout
     69      queue_context
    7370    );
    7471    if ( do_unblock ) {
     
    8582    Per_CPU_Control *cpu_self;
    8683
    87     cpu_self = _Thread_Dispatch_disable_critical( lock_context );
    88     _Thread_queue_Queue_release( queue, lock_context );
     84    cpu_self = _Thread_Dispatch_disable_critical(
     85      &queue_context->Lock_context
     86    );
     87    _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
    8988
    9089    do {
     
    101100    _Thread_Dispatch_enable( cpu_self );
    102101  } else {
    103     _Thread_queue_Queue_release( queue, lock_context );
     102    _Thread_queue_Queue_release( queue, &queue_context->Lock_context );
    104103  }
    105104
  • cpukit/score/src/threadrestart.c

    rc3d8d9e r631b3c8  
    8888
    8989typedef struct {
    90   ISR_lock_Context  Base;
     90  Thread_queue_Context  Base;
    9191#if defined(RTEMS_POSIX_API)
    92   void             *exit_value;
    93 #endif
    94 } Thread_Join_lock_context;
     92  void                 *exit_value;
     93#endif
     94} Thread_Join_context;
    9595
    9696#if defined(RTEMS_POSIX_API)
    9797static Thread_Control *_Thread_Join_flush_filter(
    98   Thread_Control      *the_thread,
    99   Thread_queue_Queue  *queue,
    100   ISR_lock_Context    *lock_context
    101 )
    102 {
    103   Thread_Join_lock_context *join_lock_context;
    104 
    105   join_lock_context = (Thread_Join_lock_context *) lock_context;
    106 
    107   the_thread->Wait.return_argument = join_lock_context->exit_value;
     98  Thread_Control       *the_thread,
     99  Thread_queue_Queue   *queue,
     100  Thread_queue_Context *queue_context
     101)
     102{
     103  Thread_Join_context *join_context;
     104
     105  join_context = (Thread_Join_context *) queue_context;
     106
     107  the_thread->Wait.return_argument = join_context->exit_value;
    108108
    109109  return the_thread;
     
    113113static void _Thread_Wake_up_joining_threads( Thread_Control *the_thread )
    114114{
    115   Thread_Join_lock_context join_lock_context;
     115  Thread_Join_context join_context;
    116116
    117117#if defined(RTEMS_POSIX_API)
    118   join_lock_context.exit_value = the_thread->Life.exit_value;
    119 #endif
    120 
    121   _Thread_State_acquire( the_thread, &join_lock_context.Base );
     118  join_context.exit_value = the_thread->Life.exit_value;
     119#endif
     120
     121  _Thread_queue_Context_initialize( &join_context.Base, NULL );
     122  _Thread_queue_Acquire(
     123    &the_thread->Join_queue,
     124    &join_context.Base.Lock_context
     125  );
    122126  _Thread_queue_Flush_critical(
    123127    &the_thread->Join_queue.Queue,
     
    128132    _Thread_queue_Flush_default_filter,
    129133#endif
    130     NULL,
    131     &join_lock_context.Base
     134    &join_context.Base
    132135  );
    133136}
  • testsuites/sptests/spintrcritical22/init.c

    rc3d8d9e r631b3c8  
    3434static Semaphore_Control *get_semaphore_control(rtems_id id)
    3535{
    36   ISR_lock_Context lock_context;
     36  Thread_queue_Context queue_context;
    3737  Semaphore_Control *sem;
    3838
    39   sem = _Semaphore_Get(id, &lock_context);
     39  sem = _Semaphore_Get(id, &queue_context, NULL);
    4040  rtems_test_assert(sem != NULL);
    41   _ISR_lock_ISR_enable(&lock_context);
     41  _ISR_lock_ISR_enable(&queue_context.Lock_context);
    4242
    4343  return sem;
  • testsuites/tmtests/tm26/task1.c

    rc3d8d9e r631b3c8  
    478478void complete_test( void )
    479479{
    480   uint32_t         index;
    481   rtems_id         task_id;
    482   ISR_lock_Context lock_context;
     480  uint32_t             index;
     481  rtems_id             task_id;
     482  ISR_lock_Context     lock_context;
     483  Thread_queue_Context queue_context;