We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9c217b1 commit 3aa8df5Copy full SHA for 3aa8df5
cores/rp2040/wiring_private.cpp
@@ -87,15 +87,22 @@ static std::map<pin_size_t, CBInfo> _map;
87
88
void _gpioInterruptDispatcher(uint gpio, uint32_t events) {
89
(void) events;
90
+
91
// Only need to lock around the std::map check, not the whole IRQ callback
- CoreMutex m(&_irqMutex);
92
- if (m) {
93
- auto irq = _map.find(gpio);
94
- if (irq != _map.end()) {
95
- auto cb = irq->second;
96
- cb.callback();
+ CBInfo *cb;
+ {
+ CoreMutex m(&_irqMutex);
+ if (m) {
+ auto irq = _map.find(gpio);
97
+ if (irq == _map.end()) {
98
+ return;
99
+ }
100
+ cb = &irq->second;
101
+ } else {
102
103
}
104
105
+ cb->callback();
106
107
108
// To be called when appropriately protected w/IRQ and mutex protects
0 commit comments