Skip to content

Commit d2a4fa4

Browse files
committed
Eliminate dedicated status variable is_reader because checking whether or not the receive ringbuffer has been allocated contains the same status information.
1 parent 1d9bdc3 commit d2a4fa4

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

src/serial/SerialDispatcher.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ std::list<SerialDispatcher::ThreadCustomerData>::iterator SerialDispatcher::find
225225

226226
void SerialDispatcher::prepareSerialReader(std::list<ThreadCustomerData>::iterator & iter)
227227
{
228-
iter->is_reader = true;
229228
if (!iter->rx_buffer)
230229
iter->rx_buffer.reset(new arduino::RingBuffer());
231230
}
@@ -240,7 +239,7 @@ void SerialDispatcher::handleSerialReader()
240239
std::end (_thread_customer_list),
241240
[c](ThreadCustomerData & d)
242241
{
243-
if (!d.is_reader)
242+
if (!d.rx_buffer)
244243
return;
245244

246245
if (!d.rx_buffer->availableForStore())

src/serial/SerialDispatcher.h

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class SerialDispatcher : public arduino::HardwareSerial
7474
osThreadId_t thread_id;
7575
arduino::RingBuffer tx_buffer;
7676
bool block_tx_buffer;
77-
bool is_reader; /* This thread has expressed interest to read from Serial via a call to either read() or available(). */
7877
mbed::SharedPtr<arduino::RingBuffer> rx_buffer; /* Only when a thread has expressed interested to read from serial a receive ringbuffer is allocated. */
7978
} ThreadCustomerData;
8079

0 commit comments

Comments
 (0)