Changeset 94b3ec59 in rtems


Ignore:
Timestamp:
Feb 13, 1996, 10:14:48 PM (26 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
da646dd
Parents:
6ca1184
Message:

changed post task extension from user set to api set and added flag
in each thread which must be set when the post switch extension is to be run.

Files:
26 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/rtems/src/signal.c

    r6ca1184 r94b3ec59  
    131131        if ( asr->is_enabled ) {
    132132          _ASR_Post_signals( signal_set, &asr->signals_posted );
     133
     134          the_thread->do_post_task_switch_extension = TRUE;
     135
    133136          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    134137            _ISR_Signals_to_thread_executing = TRUE;
  • c/src/exec/rtems/src/tasks.c

    r6ca1184 r94b3ec59  
    101101 */
    102102 
    103 User_extensions_routine _RTEMS_tasks_Switch_extension(
     103void _RTEMS_tasks_Switch_extension(
    104104  Thread_Control *executing
    105105)
     
    136136  { NULL, NULL },
    137137  NULL,                                     /* predriver */
    138   _RTEMS_tasks_Initialize_user_tasks        /* postdriver */
     138  _RTEMS_tasks_Initialize_user_tasks,       /* postdriver */
     139  _RTEMS_tasks_Switch_extension             /* post switch */
    139140};
    140141
     
    146147    _RTEMS_tasks_Delete_extension,            /* delete */
    147148    NULL,                                     /* switch */
    148     _RTEMS_tasks_Switch_extension,            /* post switch */
    149149    NULL,                                     /* begin */
    150150    NULL,                                     /* exitted */
     
    807807      asr->is_enabled = is_asr_enabled;
    808808      _ASR_Swap_signals( asr );
    809       if ( _ASR_Are_signals_pending( asr ) )
     809      if ( _ASR_Are_signals_pending( asr ) ) {
    810810        needs_asr_dispatching = TRUE;
     811        executing->do_post_task_switch_extension = TRUE;
     812      }
    811813    }
    812814  }
  • c/src/exec/sapi/headers/extension.h

    r6ca1184 r94b3ec59  
    4444typedef User_extensions_thread_restart_extension  rtems_task_restart_extension;
    4545typedef User_extensions_thread_switch_extension   rtems_task_switch_extension;
    46 typedef User_extensions_thread_post_switch_extension 
    47   rtems_task_post_switch_extension;
    4846typedef User_extensions_thread_begin_extension    rtems_task_begin_extension;
    4947typedef User_extensions_thread_exitted_extension  rtems_task_exitted_extension;
  • c/src/exec/sapi/include/rtems/extension.h

    r6ca1184 r94b3ec59  
    4444typedef User_extensions_thread_restart_extension  rtems_task_restart_extension;
    4545typedef User_extensions_thread_switch_extension   rtems_task_switch_extension;
    46 typedef User_extensions_thread_post_switch_extension 
    47   rtems_task_post_switch_extension;
    4846typedef User_extensions_thread_begin_extension    rtems_task_begin_extension;
    4947typedef User_extensions_thread_exitted_extension  rtems_task_exitted_extension;
  • c/src/exec/score/headers/apiext.h

    r6ca1184 r94b3ec59  
    1919
    2020#include <rtems/score/chain.h>
     21#include <rtems/score/thread.h>
    2122
    2223/*
     
    2728typedef void (*API_extensions_Predriver_hook)(void);
    2829typedef void (*API_extensions_Postdriver_hook)(void);
     30typedef void (*API_extensions_Postswitch_hook)(
     31                 Thread_Control *
     32             );
     33 
    2934 
    3035typedef struct {
    31   Chain_Node                     Node;
    32   API_extensions_Predriver_hook  predriver_hook;
    33   API_extensions_Postdriver_hook postdriver_hook;
     36  Chain_Node                      Node;
     37  API_extensions_Predriver_hook   predriver_hook;
     38  API_extensions_Postdriver_hook  postdriver_hook;
     39  API_extensions_Postswitch_hook  postswitch_hook;
    3440}  API_extensions_Control;
    3541
     
    8389void _API_extensions_Run_postdriver( void );
    8490
     91/*
     92 *  _API_extensions_Run_postswitch
     93 *
     94 *  DESCRIPTION:
     95 *
     96 *  XXX
     97 */
     98
     99void _API_extensions_Run_postswitch( void );
     100
    85101#endif
    86102/* end of include file */
  • c/src/exec/score/headers/thread.h

    r6ca1184 r94b3ec59  
    149149     /****************** end of common block ********************/
    150150  boolean                   is_global;
     151  boolean                   do_post_task_switch_extension;
    151152  Chain_Control            *ready;
    152153  Priority_Information      Priority_map;
  • c/src/exec/score/headers/userext.h

    r6ca1184 r94b3ec59  
    5858typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
    5959                 Thread_Control *,
    60                  Thread_Control *
    61              );
    62  
    63 typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)(
    6460                 Thread_Control *
    6561             );
     
    8682  User_extensions_thread_delete_extension       thread_delete;
    8783  User_extensions_thread_switch_extension       thread_switch;
    88   User_extensions_thread_post_switch_extension  thread_post_switch;
    8984  User_extensions_thread_begin_extension        thread_begin;
    9085  User_extensions_thread_exitted_extension      thread_exitted;
     
    231226
    232227/*
    233  *  _User_extensions_Thread_post_switch
    234  *
    235  *  DESCRIPTION:
    236  *
    237  *  This routine is used to invoke the user extension which is invoked
    238  *  after a context switch occurs (i.e. we are running in the context
    239  *  of the new thread).
    240  */
    241  
    242 STATIC INLINE void _User_extensions_Thread_post_switch (
    243   Thread_Control *executing
    244 );
    245  
    246 
    247 /*
    248228 *  _User_extensions_Thread_begin
    249229 *
  • c/src/exec/score/include/rtems/score/apiext.h

    r6ca1184 r94b3ec59  
    1919
    2020#include <rtems/score/chain.h>
     21#include <rtems/score/thread.h>
    2122
    2223/*
     
    2728typedef void (*API_extensions_Predriver_hook)(void);
    2829typedef void (*API_extensions_Postdriver_hook)(void);
     30typedef void (*API_extensions_Postswitch_hook)(
     31                 Thread_Control *
     32             );
     33 
    2934 
    3035typedef struct {
    31   Chain_Node                     Node;
    32   API_extensions_Predriver_hook  predriver_hook;
    33   API_extensions_Postdriver_hook postdriver_hook;
     36  Chain_Node                      Node;
     37  API_extensions_Predriver_hook   predriver_hook;
     38  API_extensions_Postdriver_hook  postdriver_hook;
     39  API_extensions_Postswitch_hook  postswitch_hook;
    3440}  API_extensions_Control;
    3541
     
    8389void _API_extensions_Run_postdriver( void );
    8490
     91/*
     92 *  _API_extensions_Run_postswitch
     93 *
     94 *  DESCRIPTION:
     95 *
     96 *  XXX
     97 */
     98
     99void _API_extensions_Run_postswitch( void );
     100
    85101#endif
    86102/* end of include file */
  • c/src/exec/score/include/rtems/score/thread.h

    r6ca1184 r94b3ec59  
    149149     /****************** end of common block ********************/
    150150  boolean                   is_global;
     151  boolean                   do_post_task_switch_extension;
    151152  Chain_Control            *ready;
    152153  Priority_Information      Priority_map;
  • c/src/exec/score/include/rtems/score/userext.h

    r6ca1184 r94b3ec59  
    5858typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
    5959                 Thread_Control *,
    60                  Thread_Control *
    61              );
    62  
    63 typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)(
    6460                 Thread_Control *
    6561             );
     
    8682  User_extensions_thread_delete_extension       thread_delete;
    8783  User_extensions_thread_switch_extension       thread_switch;
    88   User_extensions_thread_post_switch_extension  thread_post_switch;
    8984  User_extensions_thread_begin_extension        thread_begin;
    9085  User_extensions_thread_exitted_extension      thread_exitted;
     
    231226
    232227/*
    233  *  _User_extensions_Thread_post_switch
    234  *
    235  *  DESCRIPTION:
    236  *
    237  *  This routine is used to invoke the user extension which is invoked
    238  *  after a context switch occurs (i.e. we are running in the context
    239  *  of the new thread).
    240  */
    241  
    242 STATIC INLINE void _User_extensions_Thread_post_switch (
    243   Thread_Control *executing
    244 );
    245  
    246 
    247 /*
    248228 *  _User_extensions_Thread_begin
    249229 *
  • c/src/exec/score/inline/rtems/score/userext.inl

    r6ca1184 r94b3ec59  
    100100}
    101101
    102 /*PAGE
    103  *
    104  *  _User_extensions_Thread_post_switch
    105  *
    106  */
    107  
    108 STATIC INLINE void _User_extensions_Thread_post_switch (
    109   Thread_Control *executing
    110 )
    111 {
    112   Chain_Node              *the_node;
    113   User_extensions_Control *the_extension;
    114  
    115   for ( the_node = _User_extensions_List.first ;
    116         !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
    117         the_node = the_node->next ) {
    118  
    119     the_extension = (User_extensions_Control *) the_node;
    120  
    121     if ( the_extension->Callouts.thread_post_switch != NULL )
    122       (*the_extension->Callouts.thread_post_switch)( executing );
    123   }
    124 }
    125 
    126102#endif
    127103/* end of include file */
  • c/src/exec/score/inline/userext.inl

    r6ca1184 r94b3ec59  
    100100}
    101101
    102 /*PAGE
    103  *
    104  *  _User_extensions_Thread_post_switch
    105  *
    106  */
    107  
    108 STATIC INLINE void _User_extensions_Thread_post_switch (
    109   Thread_Control *executing
    110 )
    111 {
    112   Chain_Node              *the_node;
    113   User_extensions_Control *the_extension;
    114  
    115   for ( the_node = _User_extensions_List.first ;
    116         !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
    117         the_node = the_node->next ) {
    118  
    119     the_extension = (User_extensions_Control *) the_node;
    120  
    121     if ( the_extension->Callouts.thread_post_switch != NULL )
    122       (*the_extension->Callouts.thread_post_switch)( executing );
    123   }
    124 }
    125 
    126102#endif
    127103/* end of include file */
  • c/src/exec/score/macros/rtems/score/userext.inl

    r6ca1184 r94b3ec59  
    123123  _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
    124124
    125 /*PAGE
    126  *
    127  *  _User_extensions_Thread_post_switch
    128  *
    129  */
    130 
    131 #define _User_extensions_Thread_post_switch( _executing ) \
    132   _User_extensions_Run_list_forward(thread_post_switch, (_executing) )
    133 
    134125#endif
    135126/* end of include file */
  • c/src/exec/score/macros/userext.inl

    r6ca1184 r94b3ec59  
    123123  _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
    124124
    125 /*PAGE
    126  *
    127  *  _User_extensions_Thread_post_switch
    128  *
    129  */
    130 
    131 #define _User_extensions_Thread_post_switch( _executing ) \
    132   _User_extensions_Run_list_forward(thread_post_switch, (_executing) )
    133 
    134125#endif
    135126/* end of include file */
  • c/src/exec/score/src/apiext.c

    r6ca1184 r94b3ec59  
    8282}
    8383
     84/*PAGE
     85 *
     86 *  _API_extensions_Run_postswitch
     87 */
     88
     89void _API_extensions_Run_postswitch( void )
     90{
     91  Chain_Node             *the_node;
     92  API_extensions_Control *the_extension;
     93 
     94  for ( the_node = _API_extensions_List.first ;
     95        !_Chain_Is_tail( &_API_extensions_List, the_node ) ;
     96        the_node = the_node->next ) {
     97 
     98    the_extension = (API_extensions_Control *) the_node;
     99 
     100    if ( the_extension->postswitch_hook )
     101      (*the_extension->postswitch_hook)( _Thread_Executing );
     102  }
     103}
     104
    84105/* end of file */
  • c/src/exec/score/src/thread.c

    r6ca1184 r94b3ec59  
    1515
    1616#include <rtems/system.h>
     17#include <rtems/score/apiext.h>
    1718#include <rtems/score/context.h>
    1819#include <rtems/score/interr.h>
     
    201202  _ISR_Enable( level );
    202203
    203   _User_extensions_Thread_post_switch( executing );
     204  if ( executing->do_post_task_switch_extension ) {
     205    executing->do_post_task_switch_extension = FALSE;
     206    _API_extensions_Run_postswitch();
     207  }
    204208 
    205209}
     
    814818  }
    815819
     820  the_thread->do_post_task_switch_extension = FALSE;
    816821  the_thread->is_preemptible = the_thread->Start.is_preemptible;
    817822  the_thread->is_timeslice   = the_thread->Start.is_timeslice;
  • cpukit/rtems/src/signal.c

    r6ca1184 r94b3ec59  
    131131        if ( asr->is_enabled ) {
    132132          _ASR_Post_signals( signal_set, &asr->signals_posted );
     133
     134          the_thread->do_post_task_switch_extension = TRUE;
     135
    133136          if ( _ISR_Is_in_progress() && _Thread_Is_executing( the_thread ) )
    134137            _ISR_Signals_to_thread_executing = TRUE;
  • cpukit/rtems/src/tasks.c

    r6ca1184 r94b3ec59  
    101101 */
    102102 
    103 User_extensions_routine _RTEMS_tasks_Switch_extension(
     103void _RTEMS_tasks_Switch_extension(
    104104  Thread_Control *executing
    105105)
     
    136136  { NULL, NULL },
    137137  NULL,                                     /* predriver */
    138   _RTEMS_tasks_Initialize_user_tasks        /* postdriver */
     138  _RTEMS_tasks_Initialize_user_tasks,       /* postdriver */
     139  _RTEMS_tasks_Switch_extension             /* post switch */
    139140};
    140141
     
    146147    _RTEMS_tasks_Delete_extension,            /* delete */
    147148    NULL,                                     /* switch */
    148     _RTEMS_tasks_Switch_extension,            /* post switch */
    149149    NULL,                                     /* begin */
    150150    NULL,                                     /* exitted */
     
    807807      asr->is_enabled = is_asr_enabled;
    808808      _ASR_Swap_signals( asr );
    809       if ( _ASR_Are_signals_pending( asr ) )
     809      if ( _ASR_Are_signals_pending( asr ) ) {
    810810        needs_asr_dispatching = TRUE;
     811        executing->do_post_task_switch_extension = TRUE;
     812      }
    811813    }
    812814  }
  • cpukit/sapi/include/rtems/extension.h

    r6ca1184 r94b3ec59  
    4444typedef User_extensions_thread_restart_extension  rtems_task_restart_extension;
    4545typedef User_extensions_thread_switch_extension   rtems_task_switch_extension;
    46 typedef User_extensions_thread_post_switch_extension 
    47   rtems_task_post_switch_extension;
    4846typedef User_extensions_thread_begin_extension    rtems_task_begin_extension;
    4947typedef User_extensions_thread_exitted_extension  rtems_task_exitted_extension;
  • cpukit/score/include/rtems/score/apiext.h

    r6ca1184 r94b3ec59  
    1919
    2020#include <rtems/score/chain.h>
     21#include <rtems/score/thread.h>
    2122
    2223/*
     
    2728typedef void (*API_extensions_Predriver_hook)(void);
    2829typedef void (*API_extensions_Postdriver_hook)(void);
     30typedef void (*API_extensions_Postswitch_hook)(
     31                 Thread_Control *
     32             );
     33 
    2934 
    3035typedef struct {
    31   Chain_Node                     Node;
    32   API_extensions_Predriver_hook  predriver_hook;
    33   API_extensions_Postdriver_hook postdriver_hook;
     36  Chain_Node                      Node;
     37  API_extensions_Predriver_hook   predriver_hook;
     38  API_extensions_Postdriver_hook  postdriver_hook;
     39  API_extensions_Postswitch_hook  postswitch_hook;
    3440}  API_extensions_Control;
    3541
     
    8389void _API_extensions_Run_postdriver( void );
    8490
     91/*
     92 *  _API_extensions_Run_postswitch
     93 *
     94 *  DESCRIPTION:
     95 *
     96 *  XXX
     97 */
     98
     99void _API_extensions_Run_postswitch( void );
     100
    85101#endif
    86102/* end of include file */
  • cpukit/score/include/rtems/score/thread.h

    r6ca1184 r94b3ec59  
    149149     /****************** end of common block ********************/
    150150  boolean                   is_global;
     151  boolean                   do_post_task_switch_extension;
    151152  Chain_Control            *ready;
    152153  Priority_Information      Priority_map;
  • cpukit/score/include/rtems/score/userext.h

    r6ca1184 r94b3ec59  
    5858typedef User_extensions_routine ( *User_extensions_thread_switch_extension )(
    5959                 Thread_Control *,
    60                  Thread_Control *
    61              );
    62  
    63 typedef User_extensions_routine (*User_extensions_thread_post_switch_extension)(
    6460                 Thread_Control *
    6561             );
     
    8682  User_extensions_thread_delete_extension       thread_delete;
    8783  User_extensions_thread_switch_extension       thread_switch;
    88   User_extensions_thread_post_switch_extension  thread_post_switch;
    8984  User_extensions_thread_begin_extension        thread_begin;
    9085  User_extensions_thread_exitted_extension      thread_exitted;
     
    231226
    232227/*
    233  *  _User_extensions_Thread_post_switch
    234  *
    235  *  DESCRIPTION:
    236  *
    237  *  This routine is used to invoke the user extension which is invoked
    238  *  after a context switch occurs (i.e. we are running in the context
    239  *  of the new thread).
    240  */
    241  
    242 STATIC INLINE void _User_extensions_Thread_post_switch (
    243   Thread_Control *executing
    244 );
    245  
    246 
    247 /*
    248228 *  _User_extensions_Thread_begin
    249229 *
  • cpukit/score/inline/rtems/score/userext.inl

    r6ca1184 r94b3ec59  
    100100}
    101101
    102 /*PAGE
    103  *
    104  *  _User_extensions_Thread_post_switch
    105  *
    106  */
    107  
    108 STATIC INLINE void _User_extensions_Thread_post_switch (
    109   Thread_Control *executing
    110 )
    111 {
    112   Chain_Node              *the_node;
    113   User_extensions_Control *the_extension;
    114  
    115   for ( the_node = _User_extensions_List.first ;
    116         !_Chain_Is_tail( &_User_extensions_List, the_node ) ;
    117         the_node = the_node->next ) {
    118  
    119     the_extension = (User_extensions_Control *) the_node;
    120  
    121     if ( the_extension->Callouts.thread_post_switch != NULL )
    122       (*the_extension->Callouts.thread_post_switch)( executing );
    123   }
    124 }
    125 
    126102#endif
    127103/* end of include file */
  • cpukit/score/macros/rtems/score/userext.inl

    r6ca1184 r94b3ec59  
    123123  _User_extensions_Run_list_forward(thread_switch, (_executing, _heir) )
    124124
    125 /*PAGE
    126  *
    127  *  _User_extensions_Thread_post_switch
    128  *
    129  */
    130 
    131 #define _User_extensions_Thread_post_switch( _executing ) \
    132   _User_extensions_Run_list_forward(thread_post_switch, (_executing) )
    133 
    134125#endif
    135126/* end of include file */
  • cpukit/score/src/apiext.c

    r6ca1184 r94b3ec59  
    8282}
    8383
     84/*PAGE
     85 *
     86 *  _API_extensions_Run_postswitch
     87 */
     88
     89void _API_extensions_Run_postswitch( void )
     90{
     91  Chain_Node             *the_node;
     92  API_extensions_Control *the_extension;
     93 
     94  for ( the_node = _API_extensions_List.first ;
     95        !_Chain_Is_tail( &_API_extensions_List, the_node ) ;
     96        the_node = the_node->next ) {
     97 
     98    the_extension = (API_extensions_Control *) the_node;
     99 
     100    if ( the_extension->postswitch_hook )
     101      (*the_extension->postswitch_hook)( _Thread_Executing );
     102  }
     103}
     104
    84105/* end of file */
  • cpukit/score/src/thread.c

    r6ca1184 r94b3ec59  
    1515
    1616#include <rtems/system.h>
     17#include <rtems/score/apiext.h>
    1718#include <rtems/score/context.h>
    1819#include <rtems/score/interr.h>
     
    201202  _ISR_Enable( level );
    202203
    203   _User_extensions_Thread_post_switch( executing );
     204  if ( executing->do_post_task_switch_extension ) {
     205    executing->do_post_task_switch_extension = FALSE;
     206    _API_extensions_Run_postswitch();
     207  }
    204208 
    205209}
     
    814818  }
    815819
     820  the_thread->do_post_task_switch_extension = FALSE;
    816821  the_thread->is_preemptible = the_thread->Start.is_preemptible;
    817822  the_thread->is_timeslice   = the_thread->Start.is_timeslice;
Note: See TracChangeset for help on using the changeset viewer.