Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Philip_M_
Beginner
57 Views

how to structure a flow graph with a blocking input source

What is a good way to modify Michael Voss' Feature Detection flow graph example when the source filter providing input images is blocking waiting for another image? This is a required modification if one wants to implement this graph for a real-time input source like a video camera. I know that if the source filter function body is blocking waiting to pull an image from an input device, then one of the tbb threads will be wasted because it is idle.

I appreciate any guidance.

0 Kudos
3 Replies
Francis_R_1
Beginner
57 Views

I'm also interested in learning how to deal with blocking inputs.

RafSchietekat
Black Belt
57 Views

Couldn't you just let the Body return false to indicate that there are no more inputs, and then activate() the source_node as soon as new inputs are available again?

Sergey_V_Intel
Employee
57 Views

There is async_node that is released in the TBB 4.3 Update 6 as a preview feature. The goal of this node is exactly fit for your needs. Here is the link to documentation:

https://www.threadingbuildingblocks.org/docs/help/reference/appendices/community_preview_features/fl...

You can create your own thread that will retrieve images from some source and using async_node::async_gateway push this messages to the graph. The advantage of such approach is that image retrieval will be done outside of TBB threads. This allows to execute other TBB tasks while your threads will wait for next image.

Reply