Changeset a827447 in rtems


Ignore:
Timestamp:
Aug 11, 2016, 7:47:21 AM (3 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
424ffe4d
Parents:
fef3ea9
git-author:
Sebastian Huber <sebastian.huber@…> (08/11/16 07:47:21)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/11/16 09:13:42)
Message:

score: Dismantle _Thread_queue_Do_extract_locked()

Dismantle _Thread_queue_Do_extract_locked() into re-usable parts like
_Thread_queue_MP_set_callout() and _Thread_queue_Make_ready_again().
Use them in _Thread_queue_Surrender() to propare for a new thread queue
surrender operation.

File:
1 edited

Legend:

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

    rfef3ea9 ra827447  
    440440}
    441441
    442 bool _Thread_queue_Do_extract_locked(
    443   Thread_queue_Queue            *queue,
    444   const Thread_queue_Operations *operations,
    445   Thread_Control                *the_thread
    446442#if defined(RTEMS_MULTIPROCESSING)
    447   ,
    448   const Thread_queue_Context    *queue_context
    449 #endif
    450 )
     443static bool _Thread_queue_MP_set_callout(
     444  Thread_Control             *the_thread,
     445  const Thread_queue_Context *queue_context
     446)
     447{
     448  Thread_Proxy_control    *the_proxy;
     449  Thread_queue_MP_callout  mp_callout;
     450
     451  if ( _Objects_Is_local_id( the_thread->Object.id ) ) {
     452    return false;
     453  }
     454
     455  the_proxy = (Thread_Proxy_control *) the_thread;
     456  mp_callout = queue_context->mp_callout;
     457  _Assert( mp_callout != NULL );
     458  the_proxy->thread_queue_callout = queue_context->mp_callout;
     459  return true;
     460}
     461#endif
     462
     463static bool _Thread_queue_Make_ready_again( Thread_Control *the_thread )
    451464{
    452465  bool success;
    453466  bool unblock;
    454 
    455 #if defined(RTEMS_MULTIPROCESSING)
    456   if ( !_Objects_Is_local_id( the_thread->Object.id ) ) {
    457     Thread_Proxy_control    *the_proxy;
    458     Thread_queue_MP_callout  mp_callout;
    459 
    460     the_proxy = (Thread_Proxy_control *) the_thread;
    461     mp_callout = queue_context->mp_callout;
    462     _Assert( mp_callout != NULL );
    463     the_proxy->thread_queue_callout = queue_context->mp_callout;
    464   }
    465 #endif
    466 
    467   ( *operations->extract )( queue, the_thread );
    468467
    469468  /*
     
    485484
    486485  _Thread_Wait_restore_default( the_thread );
    487 
    488486  return unblock;
     487}
     488
     489bool _Thread_queue_Do_extract_locked(
     490  Thread_queue_Queue            *queue,
     491  const Thread_queue_Operations *operations,
     492  Thread_Control                *the_thread
     493#if defined(RTEMS_MULTIPROCESSING)
     494  ,
     495  const Thread_queue_Context    *queue_context
     496#endif
     497)
     498{
     499#if defined(RTEMS_MULTIPROCESSING)
     500  _Thread_queue_MP_set_callout( the_thread, queue_context );
     501#endif
     502  ( *operations->extract )( queue, the_thread );
     503  return _Thread_queue_Make_ready_again( the_thread );
    489504}
    490505
     
    556571      the_thread->Wait.operations,
    557572      the_thread,
    558       &queue_context.Lock_context
     573      &queue_context
    559574    );
    560575    _Thread_queue_Unblock_critical(
     
    586601
    587602#if defined(RTEMS_MULTIPROCESSING)
    588     if ( _Objects_Is_local_id( new_owner->Object.id ) )
     603    if ( !_Thread_queue_MP_set_callout( new_owner, queue_context ) )
    589604#endif
    590605    {
     
    593608    }
    594609
    595     unblock = _Thread_queue_Extract_locked(
    596       queue,
    597       operations,
    598       new_owner,
    599       queue_context
    600     );
     610    ( *operations->extract )( queue, new_owner );
     611    unblock = _Thread_queue_Make_ready_again( new_owner );
    601612
    602613    _Thread_queue_Unblock_critical(
Note: See TracChangeset for help on using the changeset viewer.