Blocking on multiple pipes #48775
Unanswered
jeremyherbert
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to build a structure where there are a number of producer threads and a single consumer thread. Each producer thread will generate an independent byte stream which is then consumed by the single consumer thread, and the generation of data will happen intermittently and unpredictably in terms of timing.
It seems like the right approach is to use pipes for something like this, but according to the documentation for
k_poll
it cannot be used to wait on multiple pipes (and I need this to block so the device can enter a lower power state).Is there any recommended way to build a structure like this? I realise I could use a FIFO (which is supported by
k_poll
) but I am worried that with a lot of small transmissions I will quickly fill up my queue. At this point I think I am considering using a ring buffer in byte mode + semaphore for each producer thread, and then waiting on all of the semaphores usingk_poll
.Beta Was this translation helpful? Give feedback.
All reactions