vodafone: non blocking circular buffer

pull/10/head
samux 2013-07-02 16:34:52 +01:00
parent a7d3226554
commit da778bd931
1 changed files with 5 additions and 11 deletions

View File

@ -55,19 +55,13 @@ public:
void queue(T k)
{
mtx.lock();
while (((write + 1) % size) == read) //if (isFull())
{
/*while((((write + 1) % size) == read))
{*/
mtx.unlock();
Thread::wait(10);
mtx.lock();
/*}*/
//read++;
//read %= size;
}
buf[write++] = k;
write %= size;
if (isFull())
{
read++;
read %= size;
}
mtx.unlock();
}