Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

"Inventing" a task at a pipeline stage

kankamuso
Beginner
88 Views
Hi,

I was wondering if something like this would work:

On a pipeline stage I create a POSIX thread and leave it running on the baclground. Then the pipeline stagereturns a NULL to the next stage. Is it possible for the living thread, somehow, to send a new task to the next stage on the pipeline?. Is the pipeline completely closed from the begining to the end?.

I am trying to do this because I have found problems with pipeline stages trying to run things on the background to leave a free CPU for other token to arrive...

Thanks in advance,

Jose.
0 Kudos
2 Replies
Kirill_R_Intel
Employee
88 Views

Hi Jose,

The token passed between pipeline stages can't be inserted from separate thread in the middle of pipeline. The token is passed from first filter to second, than third, etc.
What task are you trying to pass from POSIX thread to pipeline stage? If it is just some data, you can extract and use it in some filter. But this filter should get a token from previous filter, otherwise it will wait for it and will not execute the code taking the data from POSIX thread.

Maybe it's better to focus on initial problem. Can you describe in details what problem do you have with pipeline stages? Code sample would be very appreciated.

Regards,
Kirill

jimdempseyatthecove
Black Belt
88 Views
What is your pipeline doing when it is not throwing work into the POSIX thread(s)?
What do you want to happen if the pipeline runs out of input prior to the additional POSIX thread(s) complete?

A full description of your problem will save us some time in offering you a useful solution. (And get you a usable answer sooner.)

Jim Dempsey
Reply