BelaPlatform / bela-image-builder

Scripts to build a Bela image from scratch
MIT License
35 stars 16 forks source link

DataFifo #83

Closed giuliomoro closed 6 years ago

giuliomoro commented 6 years ago
// Uni-directional RT-safe-queue.
// A light wrapper around __wrap_mq_...
class DataFifo
{
    int create(std::string& name, size_t queueSize, bool blocking = 0);

    int send(char* buf, size_t size);

    int receive(char* buf, size_t maxSize);
private:
// add your stuff here
};

usage


DataFifo dataFifoToSlave;
DataFifo dataFifoToMaster;

otherThread()
{
    dataFifoToSlave.receive(); // block
    /// process
    dataFifoToMaster.send();
}

setup()
{
    dataFifoToSlave.create(blocksize);
    dataFifoToMaster.create(blocksize);
}

render()
{
    dataFifoToSlave.send();
    dataFifoToMaster.receive(); // non block
}
giuliomoro commented 6 years ago

wrong repo :(