Changeset 2429766 in rtems


Ignore:
Timestamp:
Mar 22, 2015, 9:37:52 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
688fbc44
Parents:
40a24661
Message:

score: Move _Thread_blocking_operation_Cancel()

Move _Thread_blocking_operation_Cancel() and make static since it is
only used by _Thread_queue_Enqueue_with_handler().

Move _Thread_blocking_operation_Finalize().

Location:
cpukit/score
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r40a24661 r2429766  
    289289    src/threadsetstate.c \
    290290    src/threadstackallocate.c src/threadstackfree.c src/threadstart.c \
    291     src/threadstartmultitasking.c src/iterateoverthreads.c \
    292     src/threadblockingoperationcancel.c
     291    src/threadstartmultitasking.c src/iterateoverthreads.c
    293292libscore_a_SOURCES += src/threadglobalconstruction.c
    294293libscore_a_SOURCES += src/threadyield.c
  • cpukit/score/include/rtems/score/threadimpl.h

    r40a24661 r2429766  
    417417 */
    418418Thread_Control *_Thread_Acquire_executing( ISR_lock_Context *lock_context );
    419 
    420 /**
    421  *  @brief Cancel a blocking operation due to ISR.
    422  *
    423  *  This method is used to cancel a blocking operation that was
    424  *  satisfied from an ISR while the thread executing was in the
    425  *  process of blocking.
    426  *
    427  *  This method will restore the previous ISR disable level during the cancel
    428  *  operation.  Thus it is an implicit _ISR_Enable().
    429  *
    430  *  @param[in] sync_state is the synchronization state
    431  *  @param[in] the_thread is the thread whose blocking is canceled
    432  *  @param[in] level is the previous ISR disable level
    433  *
    434  *  @note This is a rare routine in RTEMS.  It is called with
    435  *        interrupts disabled and only when an ISR completed
    436  *        a blocking condition in process.
    437  */
    438 void _Thread_blocking_operation_Cancel(
    439   Thread_blocking_operation_States  sync_state,
    440   Thread_Control                   *the_thread,
    441   ISR_Level                         level
    442 );
    443419
    444420/**
  • cpukit/score/src/threadqenqueue.c

    r40a24661 r2429766  
    2323#include <rtems/score/threadimpl.h>
    2424#include <rtems/score/watchdogimpl.h>
     25
     26void _Thread_blocking_operation_Finalize(
     27  Thread_Control                   *the_thread,
     28  ISR_Level                         level
     29)
     30{
     31  /*
     32   * The thread is not waiting on anything after this completes.
     33   */
     34  the_thread->Wait.queue = NULL;
     35
     36  /*
     37   *  If the sync state is timed out, this is very likely not needed.
     38   *  But better safe than sorry when it comes to critical sections.
     39   */
     40  if ( _Watchdog_Is_active( &the_thread->Timer ) ) {
     41    _Watchdog_Deactivate( &the_thread->Timer );
     42    _ISR_Enable( level );
     43    (void) _Watchdog_Remove( &the_thread->Timer );
     44  } else
     45    _ISR_Enable( level );
     46
     47  /*
     48   *  Global objects with thread queue's should not be operated on from an
     49   *  ISR.  But the sync code still must allow short timeouts to be processed
     50   *  correctly.
     51   */
     52
     53  _Thread_Unblock( the_thread );
     54
     55#if defined(RTEMS_MULTIPROCESSING)
     56  if ( !_Objects_Is_local_id( the_thread->Object.id ) )
     57    _Thread_MP_Free_proxy( the_thread );
     58#endif
     59}
     60
     61/**
     62 *  @brief Cancel a blocking operation due to ISR.
     63 *
     64 *  This method is used to cancel a blocking operation that was
     65 *  satisfied from an ISR while the thread executing was in the
     66 *  process of blocking.
     67 *
     68 *  This method will restore the previous ISR disable level during the cancel
     69 *  operation.  Thus it is an implicit _ISR_Enable().
     70 *
     71 *  @param[in] sync_state is the synchronization state
     72 *  @param[in] the_thread is the thread whose blocking is canceled
     73 *  @param[in] level is the previous ISR disable level
     74 *
     75 *  @note This is a rare routine in RTEMS.  It is called with
     76 *        interrupts disabled and only when an ISR completed
     77 *        a blocking condition in process.
     78 */
     79static void _Thread_blocking_operation_Cancel(
     80  Thread_blocking_operation_States  sync_state,
     81  Thread_Control                   *the_thread,
     82  ISR_Level                         level
     83)
     84{
     85  /*
     86   *  Cases that should not happen and why.
     87   *
     88   *  THREAD_BLOCKING_OPERATION_SYNCHRONIZED:
     89   *
     90   *  This indicates that someone did not enter a blocking
     91   *  operation critical section.
     92   *
     93   *  THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED:
     94   *
     95   *  This indicates that there was nothing to cancel so
     96   *  we should not have been called.
     97   */
     98
     99  #if defined(RTEMS_DEBUG)
     100    if ( (sync_state == THREAD_BLOCKING_OPERATION_SYNCHRONIZED) ||
     101         (sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) {
     102      _Terminate(
     103        INTERNAL_ERROR_CORE,
     104        true,
     105        INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
     106      );
     107    }
     108  #else
     109    (void) sync_state;
     110  #endif
     111
     112  _Thread_blocking_operation_Finalize( the_thread, level );
     113}
    25114
    26115void _Thread_queue_Enqueue_with_handler(
Note: See TracChangeset for help on using the changeset viewer.