diff options
Diffstat (limited to 'sys/win/wingui/longque.h')
-rw-r--r-- | sys/win/wingui/longque.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/win/wingui/longque.h b/sys/win/wingui/longque.h new file mode 100644 index 0000000..c8e1e0a --- /dev/null +++ b/sys/win/wingui/longque.h @@ -0,0 +1,28 @@ +class longque { +public: + void init(int size); + void finish(); + //1 producer-consumer safe + void insert(long l) { + buff[tail] = l; + count++; + tail++; + if (tail == max) tail = 0; + } + long remove(); + bool fullp() { + return count >= max; + } + bool emptyp() { + return count <= 0; + } +protected: + int max; + long *buff; + int head; + int tail; + int count; +}; + + + |