pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

ISR versions of mutex_try_enter and mutex_exit

Open daveythacher opened this issue 2 years ago • 3 comments

#1453 Extends mutex API to support holding the spin lock. This can be used to prevent deadlock from competing core.

daveythacher avatar Nov 17 '23 03:11 daveythacher

Note this does cause possible priority inversion, if used incorrectly.

daveythacher avatar Nov 23 '23 05:11 daveythacher

Does disabling interrupts on core 1, disable them on core 0? This patch does not cover the case of core 0 ISR and core 1 ISR racing against each other. In which case the patch is not worth much. (Even though this is horrible practice.) This would be new behavior and is capable of creating an issue like 1453. Perhaps documentation could describe the differences between the ISR and non ISR version and which is correct for certain contexts.

Note the ISR version is capable of creating a slight blocking behavior in non ISR version, which may need to be documented. I do not believe this diminishes this request, however does ask a larger question about the SDK.

daveythacher avatar Dec 03 '23 07:12 daveythacher

See #1580

daveythacher avatar Dec 17 '23 17:12 daveythacher