Hi everybody, I have a question related to implementation of tsk_lock() for Cortex-M3. The manual says that the function disables the timer interrupt and thus prevents the RTOS from switching. But disabling the interrupt and clearing a pending interrupt flag are sometimes completely different things. Calling tsk_lock() and immediately after it calling tsk_ulock() should not drastically modify application behavior. What we found is that if the timer interrupt is due to happen between the calls of tsk_lock and tsk_unlock, the interrupt will be lost regardless of how quickly you call tsk_unlock. Which to me is an error - the tsk_lock should only disable the interrupt but keep the pending flag, so that the ISR is called immediately after tsk_unlock. Otherwise tasks that are waiting on os_dly_wait will miss a beat. Which is what we see. Can anybody comment on it and tell me if this is how it was designed? Thanks.
I meant tsk_unlock that I suspect of clearing the pending flag before re-enabling timer interrupt.
The tsk_lock() and tsk_unlock() are never used in RTX for Cortex-M library. Both functions are there for compatibility reasons with ARM library.
Instead of tsk_lock/tsk_unlock you might consider using __svc functions. They are never interrupted by RTX kernel.