Hi,
the basic problem I was facing is described here
As my work progressed, I faced the need to link 1 producer thread to 3 consumer-threads derived from the same class.
In my Widget Class, the semaphore and buffer are declared as followed (based on the Semaphore example and a single consumer), which worked:
Qt Code:
QSemaphore *usedListSlots; Importer *importerThread; Converter *converterThread1; Converter *converterThread2; Converter *converterThread3;To copy to clipboard, switch view to plain text mode
My idea was, to let thread1 work on buffer[0] to buffer[99], thread2 on buffer[100] to buffer[199] and so on. The thread, that has no accessible data, should block until new data arrives.
My "emergency plan" is, to use a different semaphore for each thread and provide a pointer to it in the consumer-constructor, then acquire and release based on the actual buffer-position. But if there was a nicer way, I'd prefer the alternative
Greets,
Daedalus
Bookmarks