mirror of
https://github.com/cookiengineer/audacity
synced 2026-01-17 14:11:27 +01:00
Update Nyquist to v3.09.
This commit is contained in:
34
lib-src/libnyquist/nyquist/sys/win/wingui/longque.cpp
Normal file
34
lib-src/libnyquist/nyquist/sys/win/wingui/longque.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "stddef.h"
|
||||
#include "cppext.h"
|
||||
#include "longque.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
void longque::init(int size)
|
||||
{
|
||||
head = 0;
|
||||
tail = 0;
|
||||
count = 0;
|
||||
max = size;
|
||||
buff = (long *) malloc(sizeof(long) * size);
|
||||
}
|
||||
|
||||
|
||||
void longque::finish()
|
||||
{
|
||||
free(buff);
|
||||
}
|
||||
|
||||
|
||||
//1 producer-consumer safe
|
||||
long longque::remove()
|
||||
{
|
||||
long l;
|
||||
if (count <= 0) return 0;
|
||||
count--;
|
||||
l = buff[head++];
|
||||
if (head == max) head = 0;
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user