How to handle a NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN error

I should not be asking this question here but it should be documented! SoftDevice s130.

A possible error I can get when executing sd_mutex_acquire() is NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN . However, I have no idea what I should do now. Nothing in the documentation.  Not a peep. Now in higher level APIs the call would simply block until the mutex was released. However, there is no indication of that here.

A first guess is that I could do

while(sd_mutex_acquire() != NRF_SUCCESS)

but I don't dare do that because for all I know that could tag the CPU and throttle everything to a grinding halt. I have no idea.

So what should one do? Is this call blocking?

Here is the documentation:

Attempt to acquire a mutex.

Parameters
[in] p_mutex Pointer to the mutex to acquire.
Return values
NRF_SUCCESS The mutex was successfully acquired.
NRF_ERROR_SOC_MUTEX_ALREADY_TAKEN The mutex could not be acquired.

Not much to go on.

Related