AzureMXChip/MXCHIPAZ3166/core/lib/threadx/ports/win32/vs_2019/src/tx_thread_schedule.c
void    _tx_win32_critical_section_obtain(TX_WIN32_CRITICAL_SECTION *critical_section)
{

TX_THREAD     *thread_ptr;


    /* Is the protection owned?  */
    if (critical_section -> tx_win32_critical_section_owner == GetCurrentThreadId())
    {
    
        /* Simply increment the nested counter.  */
        critical_section -> tx_win32_critical_section_nested_count++;
    }
    else
    {        

        /* Pickup the current thread pointer.  */
        thread_ptr =  _tx_thread_current_ptr;

        /* Get the Win32 critical section.  */
        while (WaitForSingleObject(critical_section -> tx_win32_critical_section_mutex_handle, 3) != WAIT_OBJECT_0)
        {
        }
    
        /* At this point we have the mutex.  */
    
        /* Increment the nesting counter.  */
        critical_section -> tx_win32_critical_section_nested_count =  1;
    
        /* Remember the owner.  */
        critical_section -> tx_win32_critical_section_owner =  GetCurrentThreadId();
    }
}
/* Define the ThreadX Win32 critical section get, release, and release all functions.  */
Define the ThreadX Win32 critical section get, release, and release all functions.
Define the ThreadX Win32 critical section get release and release all functions .
void    _tx_win32_critical_section_obtain(TX_WIN32_CRITICAL_SECTION *critical_section)
{
TX_THREAD     *thread_ptr;
    if (critical_section -> tx_win32_critical_section_owner == GetCurrentThreadId())
    {
        critical_section -> tx_win32_critical_section_nested_count++;
    }
    else
    {        
        thread_ptr =  _tx_thread_current_ptr;
        while (WaitForSingleObject(critical_section -> tx_win32_critical_section_mutex_handle, 3) != WAIT_OBJECT_0)
        {
        }
        critical_section -> tx_win32_critical_section_nested_count =  1;
        critical_section -> tx_win32_critical_section_owner =  GetCurrentThreadId();
    }
}
void _tx_win32_critical_section_obtain ( TX_WIN32_CRITICAL_SECTION * critical_section ) { TX_THREAD * thread_ptr ; if ( critical_section -> tx_win32_critical_section_owner == GetCurrentThreadId ( ) ) { critical_section -> tx_win32_critical_section_nested_count ++ ; } else { thread_ptr = _tx_thread_current_ptr ; while ( WaitForSingleObject ( critical_section -> tx_win32_critical_section_mutex_handle , 3 ) != WAIT_OBJECT_0 ) { } critical_section -> tx_win32_critical_section_nested_count = 1 ; critical_section -> tx_win32_critical_section_owner = GetCurrentThreadId ( ) ; } }
Define the ThreadX Win32 critical section get, release, and release all functions.
Define the ThreadX Win32 critical section get release and release all functions .
/* Is the protection owned?  */ /* Simply increment the nested counter.  */ /* Pickup the current thread pointer.  */ /* Get the Win32 critical section.  */ /* At this point we have the mutex.  */ /* Increment the nesting counter.  */ /* Remember the owner.  */