12345678910111213141516171819202122232425262728293031 |
- #pragma once
- #include <ReferenceCounter.h>
- #include <Array.h>
- #include <condition_variable>
- class Block;
- class TickQueue : public virtual Framework::ReferenceCounter
- {
- private:
- int maxSize;
- int readPosition;
- int writePosition;
- Block** queue;
- std::mutex mutex;
- std::condition_variable hasBlocks;
- std::condition_variable hasNoBlocks;
- bool exit;
- public:
- TickQueue();
- ~TickQueue();
- void startNextTick(Framework::Array<Block*>* zSources);
- void addToQueue(Block* zBlock);
- Block* zNextBlock(bool& waiting);
- void requestExit();
- void waitForEmpty();
- void postTick();
- };
|