Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Array of producer - customer buffers



  • I can't figure out the architecture in any way. There is a ring buffer class. Writing and reading from which is carried out from different threads. For synchronization use
    QWaitCondition and QMutex. They are in the buffer class. Everything works fine. But the logic of the application has become more complex. The producer and customer threads can be created while the program is running, and there can be any relationship between them. for example, there may be a configuration of 1 producer -> buffer -> 2 customer, and at the same time another producer -> buffer -> 1 customer. In total, we have 2 circular buffers. I created a BufferManager class, where I started using QMap <buffer>, but QMap is not protected in any way, because if you use QMutex, it turns out a deadlock when the customer is waiting for data, but the producer cannot write it, because the QMutex is blocked by customer. How can I secure QMap?


  • Qt Champions 2019

    @Vitaliy said in Array of producer - customer buffers:

    QMap <buffer>

    What is the key? And why do you need to "secure" that map?


Log in to reply