[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] Simplify sys_check_core_locking() in contrib/ports/freertos
From: |
Craig McQueen |
Subject: |
[lwip-devel] Simplify sys_check_core_locking() in contrib/ports/freertos |
Date: |
Tue, 7 May 2019 01:55:15 +0000 |
For an LWIP_ASSERT_CORE_LOCKED() implementation under FreeRTOS -- in
contrib/ports/freertos, it looks as though its definition of
sys_check_core_locking() is more complicated than it needs to be.
There's no need for sys_lock_tcpip_core() etc, for use by LOCK_TCPIP_CORE()
etc. It's sufficient for sys_mutex_lock() etc to use FreeRTOS recursive mutex,
and then the default definition of LOCK_TCPIP_CORE() is fine.
sys_check_core_locking() can simply do:
if ( lwip_tcpip_thread )
{
LWIP_ASSERT( "lwip_core_lock", sys_mutex_is_held( &lock_tcpip_core ) );
}
While sys_mutex_is_held() can be defined as:
bool sys_mutex_is_held( sys_mutex_t *pxMutex )
{
return ( xSemaphoreGetMutexHolder( *pxMutex ) ==
xTaskGetCurrentTaskHandle() );
}
--
Craig McQueen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-devel] Simplify sys_check_core_locking() in contrib/ports/freertos,
Craig McQueen <=