Skip to content

Commit 50e79a4

Browse files
committed
CircularBuffer::push() is critical section
1 parent c5422ee commit 50e79a4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

libraries/mbed/common/SPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ int SPI::queue_transfer(const void *tx_buffer, int tx_length, void *rx_buffer, i
124124
if (_transaction_buffer.full()) {
125125
return -1; // the buffer is full
126126
} else {
127+
__disable_irq();
127128
_transaction_buffer.push(transaction);
128129
if (!spi_active(&_spi)) {
129130
dequeue_transaction();
130131
}
132+
__enable_irq();
131133
return 0;
132134
}
133135
#else

0 commit comments

Comments
 (0)