Open szsam opened 4 months ago
The rule is that tx_mutex_get cannot be called from a non-thread context with a suspension option. This is checked for in the error checking for tx_mutex_get, namely txe_mutex_get. Error checking is enabled by default. If the application bypasses error checking it must be calling all APIs from the correct context.
As for the earlier check for thread_ptr non-NULL is to handle the call of tx_mutex_get from initialization (where thread_ptr is NULL).
I hope that helps explain what is going on!
The pointer
thread_ptr
is checked for null here: https://github.com/eclipse-threadx/threadx/blob/d64ef2ab064047ab5aed15c7861e5a44ab8022e3/common/src/tx_mutex_get.c#L122-L168But it is not checked in the following block: https://github.com/eclipse-threadx/threadx/blob/d64ef2ab064047ab5aed15c7861e5a44ab8022e3/common/src/tx_mutex_get.c#L208-L395