AzureMXChip/MXCHIPAZ3166/core/lib/threadx/ports_smp/linux/gnu/src/tx_thread_smp_core_preempt.c
void  _tx_thread_smp_core_preempt(UINT core)
{

TX_THREAD   *preempt_thread;


    /* Protection is in force at this point.  */

    /* Pickup the thread pointer on the selected core.  */
    preempt_thread =  _tx_thread_current_ptr[core];

    /* Determine if there is a thread to preempt.  */
    if (preempt_thread)
    {

        /* Yes, set the deferred preemption flag for this thread. This preemption will be
           completed in the scheduler.   */
        preempt_thread -> tx_thread_linux_deferred_preempt =  TX_TRUE;

        /* Debug entry.  */
        _tx_linux_debug_entry_insert("CORE_PREEMPT_deferred", __FILE__, __LINE__);

        /* Release the semaphore that the main scheduling thread is waiting
           on.  Note that the main scheduling algorithm will take care of
           preempting the thread on this core.  */
        tx_linux_sem_post(&_tx_linux_scheduler_semaphore);
    }
}
/**************************************************************************/
/*                                                                        */
/*  FUNCTION                                               RELEASE        */
/*                                                                        */
/*    _tx_thread_smp_core_preempt                       SMP/Linux/GCC     */
/*                                                           6.1          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    William E. Lamie, Microsoft Corporation                             */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This function preempts the specified core in situations where the   */
/*    thread corresponding to this core is no longer ready or when the    */
/*    core must be used for a higher-priority thread. If the specified is */
/*    the current core, this processing is skipped since the will give up */
/*    control subsequently on its own.                                    */
/*                                                                        */
/*  INPUT                                                                 */
/*                                                                        */
/*    core                                  The core to preempt           */
/*                                                                        */
/*  OUTPUT                                                                */
/*                                                                        */
/*    None                                                                */
/*                                                                        */
/*  CALLS                                                                 */
/*                                                                        */
/*    ReleaseSemaphore                      Let scheduler run to preempt  */
/*                                            thread on core              */
/*    _tx_win32_debug_entry_insert          Make debug log entry          */
/*                                                                        */
/*  CALLED BY                                                             */
/*                                                                        */
/*    ThreadX Source                                                      */
/*                                                                        */
/*  RELEASE HISTORY                                                       */
/*                                                                        */
/*    DATE              NAME                      DESCRIPTION             */
/*                                                                        */
/*  09-30-2020     William E. Lamie         Initial Version 6.1           */
/*                                                                        */
/**************************************************************************/
FUNCTION                                               RELEASE



William E. Lamie, Microsoft Corporation

DESCRIPTION

This function preempts the specified core in situations where the
thread corresponding to this core is no longer ready or when the
core must be used for a higher-priority thread. If the specified is
the current core, this processing is skipped since the will give up
control subsequently on its own.

INPUT

core                                  The core to preempt

OUTPUT

None

CALLS

ReleaseSemaphore                      Let scheduler run to preempt
thread on core
_tx_win32_debug_entry_insert          Make debug log entry

CALLED BY



RELEASE HISTORY

DATE              NAME                      DESCRIPTION


FUNCTION RELEASE William E . Lamie Microsoft Corporation DESCRIPTION This function preempts the specified core in situations where the thread corresponding to this core is no longer ready or when the core must be used for a higher - priority thread . If the specified is the current core this processing is skipped since the will give up control subsequently on its own . INPUT core The core to preempt OUTPUT None CALLS ReleaseSemaphore Let scheduler run to preempt thread on core _tx_win32_debug_entry_insert Make debug log entry CALLED BY RELEASE HISTORY DATE NAME DESCRIPTION
void  _tx_thread_smp_core_preempt(UINT core)
{
TX_THREAD   *preempt_thread;
    preempt_thread =  _tx_thread_current_ptr[core];
    if (preempt_thread)
    {
        preempt_thread -> tx_thread_linux_deferred_preempt =  TX_TRUE;
        _tx_linux_debug_entry_insert("CORE_PREEMPT_deferred", __FILE__, __LINE__);
        tx_linux_sem_post(&_tx_linux_scheduler_semaphore);
    }
}
void _tx_thread_smp_core_preempt ( UINT core ) { TX_THREAD * preempt_thread ; preempt_thread = _tx_thread_current_ptr [ core ] ; if ( preempt_thread ) { preempt_thread -> tx_thread_linux_deferred_preempt = TX_TRUE ; _tx_linux_debug_entry_insert ( " " , __FILE__ , __LINE__ ) ; tx_linux_sem_post ( & _tx_linux_scheduler_semaphore ) ; } }
FUNCTION                                               RELEASE
FUNCTION RELEASE
/* Protection is in force at this point.  */ /* Pickup the thread pointer on the selected core.  */ /* Determine if there is a thread to preempt.  */ /* Yes, set the deferred preemption flag for this thread. This preemption will be
           completed in the scheduler.   */ /* Debug entry.  */ /* Release the semaphore that the main scheduling thread is waiting
           on.  Note that the main scheduling algorithm will take care of
           preempting the thread on this core.  */