Changeset e709aa85 in rtems


Ignore:
Timestamp:
Jul 13, 2015, 11:49:35 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
19078dc6
Parents:
d7665823
git-author:
Sebastian Huber <sebastian.huber@…> (07/13/15 11:49:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (07/23/15 06:01:14)
Message:

score: Move wait flag update to tq extract

This makes it possible to use _Thread_queue_Extract_locked() for barrier
operations which extract all threads on the queue in one critical
section.

Location:
cpukit/score
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/threadqimpl.h

    rd7665823 re709aa85  
    215215 * @param[in] operations The thread queue operations.
    216216 * @param[in] the_thread The thread to extract.
    217  */
    218 void _Thread_queue_Extract_locked(
     217 *
     218 * @return Returns the unblock indicator for _Thread_queue_Unblock_critical().
     219 * True indicates, that this thread must be unblocked by the scheduler later in
     220 * _Thread_queue_Unblock_critical(), and false otherwise.  In case false is
     221 * returned, then the thread queue enqueue procedure was interrupted.  Thus it
     222 * will unblock itself and the thread wait information is no longer accessible,
     223 * since this thread may already block on another resource in an SMP
     224 * configuration.
     225 */
     226bool _Thread_queue_Extract_locked(
    219227  Thread_queue_Queue            *queue,
    220228  const Thread_queue_Operations *operations,
     
    230238 * dispatching is enabled once the sequence to unblock the thread is complete.
    231239 *
     240 * @param[in] unblock The unblock indicator returned by
     241 * _Thread_queue_Extract_locked().
    232242 * @param[in] queue The actual thread queue.
    233243 * @param[in] the_thread The thread to extract.
     
    235245 */
    236246void _Thread_queue_Unblock_critical(
     247  bool                unblock,
    237248  Thread_queue_Queue *queue,
    238249  Thread_Control     *the_thread,
  • cpukit/score/src/coremutexsurrender.c

    rd7665823 re709aa85  
    180180   */
    181181  if ( ( the_thread = _Thread_queue_First_locked( &the_mutex->Wait_queue ) ) ) {
     182    bool unblock;
     183
    182184    /*
    183185     * We must extract the thread now since this will restore its default
     
    186188     * acquire.
    187189     */
    188     _Thread_queue_Extract_locked(
     190    unblock = _Thread_queue_Extract_locked(
    189191      &the_mutex->Wait_queue.Queue,
    190192      the_mutex->Wait_queue.operations,
     
    221223
    222224    _Thread_queue_Unblock_critical(
     225      unblock,
    223226      &the_mutex->Wait_queue.Queue,
    224227      the_thread,
  • cpukit/score/src/threadqenqueue.c

    rd7665823 re709aa85  
    101101}
    102102
    103 void _Thread_queue_Extract_locked(
     103bool _Thread_queue_Extract_locked(
    104104  Thread_queue_Queue            *queue,
    105105  const Thread_queue_Operations *operations,
     
    107107)
    108108{
     109  bool success;
     110  bool unblock;
     111
    109112  ( *operations->extract )( queue, the_thread );
    110113
     
    112115  _Thread_Wait_restore_default_operations( the_thread );
    113116  _Thread_Lock_restore_default( the_thread );
    114 }
    115 
    116 void _Thread_queue_Unblock_critical(
    117   Thread_queue_Queue *queue,
    118   Thread_Control     *the_thread,
    119   ISR_lock_Context   *lock_context
    120 )
    121 {
    122   bool success;
    123   bool unblock;
    124117
    125118  success = _Thread_Wait_flags_try_change_critical(
     
    136129  }
    137130
     131  return unblock;
     132}
     133
     134void _Thread_queue_Unblock_critical(
     135  bool                unblock,
     136  Thread_queue_Queue *queue,
     137  Thread_Control     *the_thread,
     138  ISR_lock_Context   *lock_context
     139)
     140{
    138141  if ( unblock ) {
    139142    Per_CPU_Control *cpu_self;
     
    157160)
    158161{
    159   _Thread_queue_Extract_locked( queue, operations, the_thread );
    160   _Thread_queue_Unblock_critical( queue, the_thread, lock_context );
     162  bool unblock;
     163
     164  unblock = _Thread_queue_Extract_locked( queue, operations, the_thread );
     165  _Thread_queue_Unblock_critical( unblock, queue, the_thread, lock_context );
    161166}
    162167
Note: See TracChangeset for help on using the changeset viewer.