ARMmbed / core-util

DEPRECATED: Mbed 3 utilities library
Other
12 stars 17 forks source link

Add a C re-entrant critical section API #18

Closed bremoran closed 8 years ago

bremoran commented 9 years ago

Implements the API discussed in https://github.com/ARMmbed/mbed-util/issues/16

bremoran commented 9 years ago

@rgrover @hugovincent @bogdanm @autopulated @0xc0170

bremoran commented 9 years ago

Comments?

rgrover commented 9 years ago

The nRF5x platform needs a soft-device specific critical section API; __disable_irq() is not an option. I believe critical section and atomic-ops may need to be target-specific.

bremoran commented 9 years ago

@rgrover Is that problem duplicated on any other platforms? It might be more appropriate to add a linker override to the nRF5x platform, rather than making all atomic ops target-specific. On most platforms, they will be generic operations.

rgrover commented 9 years ago

currently only the nRF5x requires platform-dependent atomics; but the same would be true for the forthcoming POSIX platform. Perhaps @hugovincent can share some thoughts. I believe we shouldn't base critical-section on disabling interrupts.

rgrover commented 9 years ago

Should we introduce a platform_enter_critical(&state) [https://github.com/ARMmbed/mbed-6lowpan-eventloop-adaptor/blob/master/source/events.cpp#L32] to handle platform specific implementations?

bogdanm commented 9 years ago

@rgrover, that seems to be the way to go, yes.

bremoran commented 9 years ago

Is this PR still relevant?

bogdanm commented 9 years ago

It is, but I'd say not for our feature freeze. We can deal with it later.

bremoran commented 8 years ago

We should check for a race between __get_PRIMASK and __disable_irq

0xc0170 commented 8 years ago

I believe this one can be closed, resolved in #88