Changeset 7fcb71a in rtems


Ignore:
Timestamp:
Feb 17, 2015, 12:43:57 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
fd14430
Parents:
8d6e6eeb
Message:

score: Fix _Thread_Start_multitasking() on SMP

Close #2268.

File:
1 edited

Legend:

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

    r8d6e6eeb r7fcb71a  
    4242#if defined(RTEMS_SMP)
    4343  _CPU_SMP_Prepare_start_multitasking();
    44 
    45   /*
    46    * The _CPU_Context_Restart_self() implementations usually assume that self
    47    * context is executing.
    48    *
    49    * FIXME: We have a race condition here in case another thread already
    50    * performed scheduler operations and moved our heir thread to another
    51    * processor.  The time frame for this is likely too small to be practically
    52    * relevant.  See https://devel.rtems.org/ticket/2268.
    53    */
    54   _CPU_Context_Set_is_executing( &heir->Registers, true );
    5544#endif
    5645
    5746#if defined(_CPU_Start_multitasking)
    5847  _CPU_Start_multitasking( &heir->Registers );
     48#elif defined(RTEMS_SMP)
     49  {
     50    Context_Control trash;
     51
     52    /*
     53     * Mark the trash context as executing to not confuse the
     54     * _CPU_Context_switch().  On SMP configurations the context switch
     55     * contains a special hand over section to atomically switch from the
     56     * executing to the currently selected heir thread.
     57     */
     58    _CPU_Context_Set_is_executing( &trash, true );
     59    _CPU_Context_switch( &trash, &heir->Registers );
     60  }
    5961#else
    6062  _CPU_Context_Restart_self( &heir->Registers );
Note: See TracChangeset for help on using the changeset viewer.