Changeset 0e1d11f3 in rtems


Ignore:
Timestamp:
May 27, 2016, 11:26:53 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
93306058
Parents:
dfcc8bb
git-author:
Sebastian Huber <sebastian.huber@…> (05/27/16 11:26:53)
git-committer:
Sebastian Huber <sebastian.huber@…> (05/30/16 14:16:21)
Message:

score: Add _Thread_queue_Context_set_MP_callout()

Add _Thread_queue_Context_set_MP_callout() to simplify
_Thread_queue_Context_initialize(). This makes it possible to more
easily add additional fields to Thread_queue_Context.

Files:
32 edited

Legend:

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

    rdfcc8bb r0e1d11f3  
    376376        if (!the_networkSemaphore)
    377377                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
    378         _Thread_queue_Context_initialize(&queue_context, NULL);
     378        _Thread_queue_Context_initialize(&queue_context);
    379379        _ISR_lock_ISR_disable(&queue_context.Lock_context);
    380380        status = _CORE_mutex_Seize (
     
    409409        if (!the_networkSemaphore)
    410410                rtems_panic ("rtems-net: network sema obtain: network not initialised\n");
    411         _Thread_queue_Context_initialize(&queue_context, NULL);
     411        _Thread_queue_Context_initialize(&queue_context);
    412412        _ISR_lock_ISR_disable(&queue_context.Lock_context);
    413413        status = _CORE_mutex_Surrender (
  • cpukit/posix/include/rtems/posix/barrierimpl.h

    rdfcc8bb r0e1d11f3  
    6969)
    7070{
    71   _Thread_queue_Context_initialize( queue_context, NULL );
     71  _Thread_queue_Context_initialize( queue_context );
    7272  return (POSIX_Barrier_Control *) _Objects_Get(
    7373    (Objects_Id) *barrier,
  • cpukit/posix/include/rtems/posix/mqueueimpl.h

    rdfcc8bb r0e1d11f3  
    112112)
    113113{
    114   _Thread_queue_Context_initialize( queue_context, NULL );
     114  _Thread_queue_Context_initialize( queue_context );
    115115  return (POSIX_Message_queue_Control *) _Objects_Get(
    116116    id,
  • cpukit/posix/include/rtems/posix/semaphoreimpl.h

    rdfcc8bb r0e1d11f3  
    6060)
    6161{
    62   _Thread_queue_Context_initialize( queue_context, NULL );
     62  _Thread_queue_Context_initialize( queue_context );
    6363  return (POSIX_Semaphore_Control *) _Objects_Get(
    6464    (Objects_Id) *id,
  • cpukit/rtems/include/rtems/rtems/barrierimpl.h

    rdfcc8bb r0e1d11f3  
    7575)
    7676{
    77   _Thread_queue_Context_initialize( queue_context, NULL );
     77  _Thread_queue_Context_initialize( queue_context );
    7878  return (Barrier_Control *)
    7979    _Objects_Get( id, &queue_context->Lock_context, &_Barrier_Information );
  • cpukit/rtems/include/rtems/rtems/messageimpl.h

    rdfcc8bb r0e1d11f3  
    8888}
    8989
    90 RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Do_get(
    91   Objects_Id               id,
    92   Thread_queue_Context    *queue_context
    93 #if defined(RTEMS_MULTIPROCESSING)
    94   ,
    95   Thread_queue_MP_callout  mp_callout
    96 #endif
     90RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get(
     91  Objects_Id            id,
     92  Thread_queue_Context *queue_context
    9793)
    9894{
    99   _Thread_queue_Context_initialize( queue_context, mp_callout );
     95  _Thread_queue_Context_initialize( queue_context );
    10096  return (Message_queue_Control *) _Objects_Get(
    10197    id,
     
    104100  );
    105101}
    106 
    107 #if defined(RTEMS_MULTIPROCESSING)
    108   #define _Message_queue_Get( id, queue_context, mp_callout ) \
    109     _Message_queue_Do_get( id, queue_context, mp_callout )
    110 #else
    111   #define _Message_queue_Get( id, queue_context, mp_callout ) \
    112     _Message_queue_Do_get( id, queue_context )
    113 #endif
    114102
    115103RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Allocate( void )
  • cpukit/rtems/include/rtems/rtems/semimpl.h

    rdfcc8bb r0e1d11f3  
    5959}
    6060
    61 RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Do_get(
    62   Objects_Id               id,
    63   Thread_queue_Context    *queue_context
    64 #if defined(RTEMS_MULTIPROCESSING)
    65   ,
    66   Thread_queue_MP_callout  mp_callout
    67 #endif
     61RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get(
     62  Objects_Id            id,
     63  Thread_queue_Context *queue_context
    6864)
    6965{
    70   _Thread_queue_Context_initialize( queue_context, mp_callout );
     66  _Thread_queue_Context_initialize( queue_context );
    7167  return (Semaphore_Control *) _Objects_Get(
    7268    id,
     
    7571  );
    7672}
    77 
    78 #if defined(RTEMS_MULTIPROCESSING)
    79   #define _Semaphore_Get( id, queue_context, mp_callout ) \
    80     _Semaphore_Do_get( id, queue_context, mp_callout )
    81 #else
    82   #define _Semaphore_Get( id, queue_context, mp_callout ) \
    83     _Semaphore_Do_get( id, queue_context )
    84 #endif
    8573
    8674#ifdef __cplusplus
  • cpukit/rtems/src/msgqbroadcast.c

    rdfcc8bb r0e1d11f3  
    4141  }
    4242
    43   the_message_queue = _Message_queue_Get(
    44     id,
    45     &queue_context,
    46     _Message_queue_Core_message_queue_mp_support
    47   );
     43  the_message_queue = _Message_queue_Get( id, &queue_context );
    4844
    4945  if ( the_message_queue == NULL ) {
     
    5551  }
    5652
     53  _Thread_queue_Context_set_MP_callout(
     54    &queue_context,
     55    _Message_queue_Core_message_queue_mp_support
     56  );
    5757  status = _CORE_message_queue_Broadcast(
    5858    &the_message_queue->message_queue,
  • cpukit/rtems/src/msgqdelete.c

    rdfcc8bb r0e1d11f3  
    3030
    3131  _Objects_Allocator_lock();
    32   the_message_queue = _Message_queue_Get(
    33     id,
    34     &queue_context,
    35     _Message_queue_MP_Send_object_was_deleted
    36   );
     32  the_message_queue = _Message_queue_Get( id, &queue_context );
    3733
    3834  if ( the_message_queue == NULL ) {
     
    5551  _Objects_Close( &_Message_queue_Information, &the_message_queue->Object );
    5652
     53  _Thread_queue_Context_set_MP_callout(
     54    &queue_context,
     55    _Message_queue_MP_Send_object_was_deleted
     56  );
    5757  _CORE_message_queue_Close(
    5858    &the_message_queue->message_queue,
  • cpukit/rtems/src/msgqflush.c

    rdfcc8bb r0e1d11f3  
    3333  }
    3434
    35   the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
     35  the_message_queue = _Message_queue_Get( id, &queue_context );
    3636
    3737  if ( the_message_queue == NULL ) {
  • cpukit/rtems/src/msgqgetnumberpending.c

    rdfcc8bb r0e1d11f3  
    3333  }
    3434
    35   the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
     35  the_message_queue = _Message_queue_Get( id, &queue_context );
    3636
    3737  if ( the_message_queue == NULL ) {
  • cpukit/rtems/src/msgqreceive.c

    rdfcc8bb r0e1d11f3  
    4646  }
    4747
    48   the_message_queue = _Message_queue_Get( id, &queue_context, NULL );
     48  the_message_queue = _Message_queue_Get( id, &queue_context );
    4949
    5050  if ( the_message_queue == NULL ) {
  • cpukit/rtems/src/msgqsend.c

    rdfcc8bb r0e1d11f3  
    3636  }
    3737
    38   the_message_queue = _Message_queue_Get(
    39     id,
    40     &queue_context,
    41     _Message_queue_Core_message_queue_mp_support
    42   );
     38  the_message_queue = _Message_queue_Get( id, &queue_context );
    4339
    4440  if ( the_message_queue == NULL ) {
     
    5450    &queue_context
    5551  );
     52  _Thread_queue_Context_set_MP_callout(
     53    &queue_context,
     54    _Message_queue_Core_message_queue_mp_support
     55  );
    5656  status = _CORE_message_queue_Send(
    5757    &the_message_queue->message_queue,
  • cpukit/rtems/src/msgqurgent.c

    rdfcc8bb r0e1d11f3  
    3636  }
    3737
    38   the_message_queue = _Message_queue_Get(
    39     id,
    40     &queue_context,
    41     _Message_queue_Core_message_queue_mp_support
    42   );
     38  the_message_queue = _Message_queue_Get( id, &queue_context );
    4339
    4440  if ( the_message_queue == NULL ) {
     
    5450    &queue_context
    5551  );
     52  _Thread_queue_Context_set_MP_callout(
     53    &queue_context,
     54    _Message_queue_Core_message_queue_mp_support
     55  );
    5656  status = _CORE_message_queue_Urgent(
    5757    &the_message_queue->message_queue,
  • cpukit/rtems/src/semdelete.c

    rdfcc8bb r0e1d11f3  
    3232
    3333  _Objects_Allocator_lock();
    34   the_semaphore = _Semaphore_Get(
    35     id,
    36     &queue_context,
    37     _Semaphore_MP_Send_object_was_deleted
    38   );
     34  the_semaphore = _Semaphore_Get( id, &queue_context );
    3935
    4036  if ( the_semaphore == NULL ) {
  • cpukit/rtems/src/semflush.c

    rdfcc8bb r0e1d11f3  
    2828  rtems_attribute       attribute_set;
    2929
    30   the_semaphore = _Semaphore_Get(
    31     id,
    32     &queue_context,
    33     _Semaphore_MP_Send_object_was_deleted
    34   );
     30  the_semaphore = _Semaphore_Get( id, &queue_context );
    3531
    3632  if ( the_semaphore == NULL ) {
     
    4541
    4642  attribute_set = the_semaphore->attribute_set;
     43
     44  _Thread_queue_Context_set_MP_callout(
     45    &queue_context,
     46    _Semaphore_MP_Send_object_was_deleted
     47  );
    4748
    4849#if defined(RTEMS_SMP)
  • cpukit/rtems/src/semobtain.c

    rdfcc8bb r0e1d11f3  
    4747  Status_Control        status;
    4848
    49   the_semaphore = _Semaphore_Get( id, &queue_context, NULL );
     49  the_semaphore = _Semaphore_Get( id, &queue_context );
    5050
    5151  if ( the_semaphore == NULL ) {
  • cpukit/rtems/src/semrelease.c

    rdfcc8bb r0e1d11f3  
    3333  Status_Control        status;
    3434
    35   the_semaphore = _Semaphore_Get(
    36     id,
    37     &queue_context,
    38     _Semaphore_Core_mutex_mp_support
    39   );
     35  the_semaphore = _Semaphore_Get( id, &queue_context );
    4036
    4137  if ( the_semaphore == NULL ) {
     
    4642#endif
    4743  }
     44
     45  _Thread_queue_Context_set_MP_callout(
     46    &queue_context,
     47    _Semaphore_Core_mutex_mp_support
     48  );
    4849
    4950  attribute_set = the_semaphore->attribute_set;
  • cpukit/rtems/src/semsetpriority.c

    rdfcc8bb r0e1d11f3  
    104104  }
    105105
    106   the_semaphore = _Semaphore_Get( semaphore_id, &queue_context, NULL );
     106  the_semaphore = _Semaphore_Get( semaphore_id, &queue_context );
    107107
    108108  if ( the_semaphore == NULL ) {
  • cpukit/score/include/rtems/score/mrspimpl.h

    rdfcc8bb r0e1d11f3  
    190190  Thread_queue_Context queue_context;
    191191
    192   _Thread_queue_Context_initialize( &queue_context, NULL );
     192  _Thread_queue_Context_initialize( &queue_context );
    193193  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    194194  _MRSP_Acquire_critical( mrsp, &queue_context );
  • cpukit/score/include/rtems/score/threadq.h

    rdfcc8bb r0e1d11f3  
    6464 */
    6565typedef struct {
     66  /**
     67   * @brief The lock context for the thread queue acquire and release
     68   * operations.
     69   */
    6670  ISR_lock_Context Lock_context;
     71
     72  /**
     73   * @brief Callout to unblock the thread in case it is actually a thread
     74   * proxy.
     75   *
     76   * This field is only used on multiprocessing configurations.  Used by
     77   * thread queue extract and unblock methods for objects with multiprocessing
     78   * (MP) support.
     79   *
     80   * @see _Thread_queue_Context_set_MP_callout().
     81   */
    6782#if defined(RTEMS_MULTIPROCESSING)
    6883  Thread_queue_MP_callout mp_callout;
  • cpukit/score/include/rtems/score/threadqimpl.h

    rdfcc8bb r0e1d11f3  
    5454} Thread_queue_Syslock_queue;
    5555
    56 RTEMS_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;
     56/**
     57 * @brief Initializes a thread queue context.
     58 *
     59 * @param queue_context The thread queue context to initialize.
     60 */
     61RTEMS_INLINE_ROUTINE void _Thread_queue_Context_initialize(
     62  Thread_queue_Context *queue_context
     63)
     64{
     65#if defined(RTEMS_MULTIPROCESSING) && defined(RTEMS_DEBUG)
     66  queue_context->mp_callout = NULL;
    6667#else
    6768  (void) queue_context;
     
    7071
    7172/**
    72  * @brief Initializes a thread queue context.
    73  *
    74  * @param queue_context The thread queue context to initialize.
     73 * @brief Sets the MP callout in the thread queue context.
     74 *
     75 * @param queue_context The thread queue context.
    7576 * @param mp_callout Callout to unblock the thread in case it is actually a
    7677 *   thread proxy.  This parameter is only used on multiprocessing
     
    7980 */
    8081#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     )
     82RTEMS_INLINE_ROUTINE void _Thread_queue_Context_set_MP_callout(
     83  Thread_queue_Context    *queue_context,
     84  Thread_queue_MP_callout  mp_callout
     85)
     86{
     87  queue_context->mp_callout = mp_callout;
     88}
     89#else
     90#define _Thread_queue_Context_set_MP_callout( queue_context, mp_callout ) \
     91  do { \
     92    (void) queue_context; \
     93  } while ( 0 )
    9794#endif
    9895
  • cpukit/score/src/apimutexlock.c

    rdfcc8bb r0e1d11f3  
    3232    _Thread_Set_life_protection( THREAD_LIFE_PROTECTED );
    3333
    34   _Thread_queue_Context_initialize( &queue_context, NULL );
     34  _Thread_queue_Context_initialize( &queue_context );
    3535  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    3636
  • cpukit/score/src/apimutexunlock.c

    rdfcc8bb r0e1d11f3  
    3232  restore_thread_life_protection = the_mutex->Mutex.nest_count == 1;
    3333
    34   _Thread_queue_Context_initialize( &queue_context, NULL );
     34  _Thread_queue_Context_initialize( &queue_context );
    3535  _ISR_lock_ISR_disable( &queue_context.Lock_context );
    3636  _CORE_mutex_Surrender( &the_mutex->Mutex, &queue_context );
  • cpukit/score/src/condition.c

    rdfcc8bb r0e1d11f3  
    248248
    249249  condition = _Condition_Get( _condition );
    250   _Thread_queue_Context_initialize( &context.Base, NULL );
     250  _Thread_queue_Context_initialize( &context.Base );
    251251  _ISR_lock_ISR_disable( &context.Base.Lock_context );
    252252  _Condition_Queue_acquire_critical( condition, &context.Base.Lock_context );
  • cpukit/score/src/mpci.c

    rdfcc8bb r0e1d11f3  
    326326
    327327  executing = _Thread_Get_executing();
    328   _Thread_queue_Context_initialize( &queue_context, NULL );
     328  _Thread_queue_Context_initialize( &queue_context );
    329329
    330330  for ( ; ; ) {
  • cpukit/score/src/mutex.c

    rdfcc8bb r0e1d11f3  
    294294
    295295  mutex = _Mutex_Get( _mutex );
    296   _Thread_queue_Context_initialize( &queue_context, NULL );
     296  _Thread_queue_Context_initialize( &queue_context );
    297297  executing = _Mutex_Queue_acquire( mutex, &queue_context.Lock_context );
    298298
     
    423423
    424424  mutex = _Mutex_recursive_Get( _mutex );
    425   _Thread_queue_Context_initialize( &queue_context, NULL );
     425  _Thread_queue_Context_initialize( &queue_context );
    426426  executing = _Mutex_Queue_acquire(
    427427    &mutex->Mutex,
  • cpukit/score/src/semaphore.c

    rdfcc8bb r0e1d11f3  
    115115
    116116  sem = _Semaphore_Get( _sem );
    117   _Thread_queue_Context_initialize( &queue_context, NULL );
     117  _Thread_queue_Context_initialize( &queue_context );
    118118  _Semaphore_Queue_acquire( sem, &queue_context.Lock_context );
    119119
  • cpukit/score/src/threadqenqueue.c

    rdfcc8bb r0e1d11f3  
    196196  Thread_queue_Queue   *queue;
    197197
    198   _Thread_queue_Context_initialize(
    199     &queue_context,
    200     _Thread_queue_MP_callout_do_nothing
    201   );
     198  _Thread_queue_Context_initialize( &queue_context );
    202199  lock = _Thread_Lock_acquire( the_thread, &queue_context.Lock_context );
    203200
     
    207204    _SMP_Assert( lock == &queue->Lock );
    208205
     206    _Thread_queue_Context_set_MP_callout(
     207      &queue_context,
     208      _Thread_queue_MP_callout_do_nothing
     209    );
    209210    _Thread_queue_Extract_critical(
    210211      queue,
     
    230231  Thread_Control       *the_thread;
    231232
    232   _Thread_queue_Context_initialize( &queue_context, mp_callout );
     233  _Thread_queue_Context_initialize( &queue_context );
     234  _Thread_queue_Context_set_MP_callout( &queue_context, mp_callout );
    233235  _Thread_queue_Acquire( the_thread_queue, &queue_context.Lock_context );
    234236
  • cpukit/score/src/threadrestart.c

    rdfcc8bb r0e1d11f3  
    119119#endif
    120120
    121   _Thread_queue_Context_initialize( &join_context.Base, NULL );
     121  _Thread_queue_Context_initialize( &join_context.Base );
    122122  _Thread_queue_Acquire(
    123123    &the_thread->Join_queue,
  • testsuites/sptests/spintrcritical22/init.c

    rdfcc8bb r0e1d11f3  
    3737  Semaphore_Control *sem;
    3838
    39   sem = _Semaphore_Get(id, &queue_context, NULL);
     39  sem = _Semaphore_Get(id, &queue_context);
    4040  rtems_test_assert(sem != NULL);
    4141  _ISR_lock_ISR_enable(&queue_context.Lock_context);
  • testsuites/tmtests/tm26/task1.c

    rdfcc8bb r0e1d11f3  
    515515  benchmark_timer_initialize();
    516516    for ( index=1 ; index <= OPERATION_COUNT ; index++ ) {
    517       (void) _Semaphore_Get( Semaphore_id, &queue_context, NULL );
     517      (void) _Semaphore_Get( Semaphore_id, &queue_context );
    518518      _ISR_lock_ISR_enable( &queue_context.Lock_context );
    519519    }
Note: See TracChangeset for help on using the changeset viewer.