Skip to content

Commit da778bd

Browse files
committed
vodafone: non blocking circular buffer
1 parent a7d3226 commit da778bd

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

libraries/net/VodafoneUSBModem/core/MtxCircBuffer.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,13 @@ class MtxCircBuffer
5555
void queue(T k)
5656
{
5757
mtx.lock();
58-
while (((write + 1) % size) == read) //if (isFull())
59-
{
60-
/*while((((write + 1) % size) == read))
61-
{*/
62-
mtx.unlock();
63-
Thread::wait(10);
64-
mtx.lock();
65-
/*}*/
66-
//read++;
67-
//read %= size;
68-
}
6958
buf[write++] = k;
7059
write %= size;
60+
if (isFull())
61+
{
62+
read++;
63+
read %= size;
64+
}
7165
mtx.unlock();
7266
}
7367

0 commit comments

Comments
 (0)