Changeset a6502a58 in rtems


Ignore:
Timestamp:
May 6, 2015, 9:54:19 AM (4 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
5b9dfff5
Parents:
c639cf2
Message:

score: Fix Thread_Control and Thread_Proxy_control

Fix layout of the common block of Thread_Control and
Thread_Proxy_control. Ensure that the offsets match.

Location:
cpukit/score
Files:
2 edited

Legend:

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

    rc639cf2 ra6502a58  
    250250
    251251/**
     252 * @brief Priority change handler.
     253 *
     254 * @param[in] the_thread The thread.
     255 * @param[in] new_priority The new priority value.
     256 * @param[in] context The handler context.
     257 *
     258 * @see _Thread_Priority_set_change_handler().
     259 */
     260typedef void (*Thread_Priority_change_handler)(
     261  Thread_Control   *the_thread,
     262  Priority_Control  new_priority,
     263  void             *context
     264);
     265
     266/**
     267 * @brief Thread priority control.
     268 */
     269typedef struct {
     270  /**
     271   * @brief Generation of the current priority value.
     272   *
     273   * It is used in _Thread_Change_priority() to serialize the update of
     274   * priority related data structures.
     275   */
     276  uint32_t generation;
     277
     278  /**
     279   * @brief Priority change handler.
     280   *
     281   * Called by _Thread_Change_priority() to notify a thread about a priority
     282   * change.  In case this thread waits currently for a resource the handler
     283   * may adjust its data structures according to the new priority value.  This
     284   * handler must not be NULL, instead the default handler
     285   * _Thread_Priority_change_do_nothing() should be used in case nothing needs
     286   * to be done during a priority change.
     287   *
     288   * @see _Thread_Priority_set_change_handler() and
     289   * _Thread_Priority_restore_default_change_handler().
     290   */
     291  Thread_Priority_change_handler change_handler;
     292
     293  /**
     294   * @brief Context for priority change handler.
     295   *
     296   * @see _Thread_Priority_set_change_handler().
     297   */
     298  void *change_handler_context;
     299} Thread_Priority_control;
     300
     301/**
    252302 *  @brief Union type to hold a pointer to an immutable or a mutable object.
    253303 *
     
    340390  /** This field is the base priority of this proxy. */
    341391  Priority_Control         real_priority;
     392
     393  /**
     394   * @brief Thread priority control.
     395   */
     396  Thread_Priority_control  Priority;
     397
    342398  /** This field is the number of mutexes currently held by this proxy. */
    343399  uint32_t                 resource_count;
     
    375431/** This macro defines the last API which has threads. */
    376432#define THREAD_API_LAST  THREAD_API_POSIX
    377 
    378 /**
    379  * @brief Priority change handler.
    380  *
    381  * @param[in] the_thread The thread.
    382  * @param[in] new_priority The new priority value.
    383  * @param[in] context The handler context.
    384  *
    385  * @see _Thread_Priority_set_change_handler().
    386  */
    387 typedef void (*Thread_Priority_change_handler)(
    388   Thread_Control   *the_thread,
    389   Priority_Control  new_priority,
    390   void             *context
    391 );
    392 
    393 /**
    394  * @brief Thread priority control.
    395  */
    396 typedef struct {
    397   /**
    398    * @brief Generation of the current priority value.
    399    *
    400    * It is used in _Thread_Change_priority() to serialize the update of
    401    * priority related data structures.
    402    */
    403   uint32_t generation;
    404 
    405   /**
    406    * @brief Priority change handler.
    407    *
    408    * Called by _Thread_Change_priority() to notify a thread about a priority
    409    * change.  In case this thread waits currently for a resource the handler
    410    * may adjust its data structures according to the new priority value.  This
    411    * handler must not be NULL, instead the default handler
    412    * _Thread_Priority_change_do_nothing() should be used in case nothing needs
    413    * to be done during a priority change.
    414    *
    415    * @see _Thread_Priority_set_change_handler() and
    416    * _Thread_Priority_restore_default_change_handler().
    417    */
    418   Thread_Priority_change_handler change_handler;
    419 
    420   /**
    421    * @brief Context for priority change handler.
    422    *
    423    * @see _Thread_Priority_set_change_handler().
    424    */
    425   void *change_handler_context;
    426 } Thread_Priority_control;
    427433
    428434typedef struct Thread_Action Thread_Action;
     
    678684  /** This field is the number of mutexes currently held by this thread. */
    679685  uint32_t                 resource_count;
    680 
    681 #if defined(RTEMS_SMP)
    682   /**
    683    * @brief Thread lock control.
    684    */
    685   Thread_Lock_control Lock;
    686 #endif
    687 
    688686  /** This field is the blocking information for this thread. */
    689687  Thread_Wait_information  Wait;
     
    694692  MP_packet_Prefix        *receive_packet;
    695693#endif
     694     /*================= end of common block =================*/
     695
     696#if defined(RTEMS_SMP)
     697  /**
     698   * @brief Thread lock control.
     699   */
     700  Thread_Lock_control Lock;
     701#endif
     702
    696703#ifdef __RTEMS_STRICT_ORDER_MUTEX__
    697704  /** This field is the head of queue of priority inheritance mutex
     
    707714  Resource_Node            Resource_node;
    708715#endif
    709      /*================= end of common block =================*/
    710716#if defined(RTEMS_MULTIPROCESSING)
    711717  /** This field is true if the thread is offered globally */
  • cpukit/score/src/thread.c

    rc639cf2 ra6502a58  
    2121#include <rtems/score/threadimpl.h>
    2222#include <rtems/score/interr.h>
     23
     24#define THREAD_OFFSET_ASSERT( field ) \
     25  RTEMS_STATIC_ASSERT( \
     26    offsetof( Thread_Control, field ) == offsetof( Thread_Proxy_control, field ), \
     27    field \
     28  )
     29
     30THREAD_OFFSET_ASSERT( Object );
     31THREAD_OFFSET_ASSERT( RBNode );
     32THREAD_OFFSET_ASSERT( current_state );
     33THREAD_OFFSET_ASSERT( current_priority );
     34THREAD_OFFSET_ASSERT( real_priority );
     35THREAD_OFFSET_ASSERT( Priority );
     36THREAD_OFFSET_ASSERT( resource_count );
     37THREAD_OFFSET_ASSERT( Wait );
     38THREAD_OFFSET_ASSERT( Timer );
     39#if defined(RTEMS_MULTIPROCESSING)
     40THREAD_OFFSET_ASSERT( receive_packet );
     41#endif
    2342
    2443void _Thread_Handler_initialization(void)
Note: See TracChangeset for help on using the changeset viewer.