AnsweredAssumed Answered

MQX_CHECK_VALIDITY

Question asked by Alessandro Biasci on Jul 7, 2016
Latest reply on Jul 7, 2016 by Daniel Chen

Hi all,

             I have a general question about the code executed if MQX_CHECK_VALIDITY is set.

This is an example of _lwsem_post from MQX 4.2.2 :

 

_mqx_uint _lwsem_post
(
    LWSEM_STRUCT_PTR sem_ptr
)
{ /* Body */

/* ...... */
#if MQX_CHECK_VALIDITY
    if (sem_ptr->VALID != LWSEM_VALID)
    {
        _KLOGX2(KLOG_lwsem_post, MQX_INVALID_LWSEM);
        return (MQX_INVALID_LWSEM);
    } /* Endif */
#endif /* MQX_CHECK_VALIDITY */
/* ...... */

 

My question is:

  • Why this code is executed without any kind of mutual exclusion (mutex, interrupt disable, ...) ? The current task can be preempted during the check and another task can "validate/invalidate" the lwsem. I'm missing something in the implementation (sorry for this) ?

 

 

Regards,

    Alessandro.

Outcomes