Replies: 2 comments 1 reply
-
|
Hey Amol,
it is a difficult to answer w/o any code.
So let's me try to sketch how I would do it.
The data is passed continously to a sender, then processed from a processor (probably bound to a default_executor) and then it has to go to an other processor that it bound to a main_executor, an executor that works on the main loop and then it updates there your view.
Or your last receiver is doing its work on a default_executor and provides in a double-buffer manner the data to the view. And the view on the main-thread picks up new data when it is there in its own refresh speed.
You have always to be aware that the data flows from the sender to the receivers. The only mechanism from the receivers to the senders is when a receiver is ready to receive new data.
I hope this helps a bit.
Regards, Felix
… Amol Jadhav ***@***.***> hat am 28.02.2025 08:00 CET geschrieben:
I'm trying to explore channels for one my requirement. I've a big processing pipeline (channels+processes) which prepares the view, and there is a window lifecycle (this window creation needs to be separate than the pipeline) which runs on main thread:
image.png (view on web) https://github.com/user-attachments/assets/087b5d61-98d7-49f0-b266-74c04e68fea4
In the foreground state of this window, I want the channel's process to get received. To this window I gave copy of last stlab::receiver<View> however, window doesn't get the view from the channel. This lifecycle is managed by System on the main thread.
void Window::foreground() {
auto p = _view | [this](View v) noexcept { // paint view} ;
_view.set_ready();
p.set_ready();
}
Here the foreground callback is not getting the view at all even if it is has been sent by the stlab::sender. The creation of Window needs to be separate from the channels/processes preparing the view.
How can I make the window wait and receive the View? I can't give it main_executor because that will cause deadlock because foreground is already on the main thread and needs the view.
@FelixPetriconi https://github.com/FelixPetriconi @sean-parent https://github.com/sean-parent
—
Reply to this email directly, view it on GitHub #560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEVQGLOKYRWQHIEFPMQM4D2SACP3AVCNFSM6AAAAABYBTICKOVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZYGAZDGNJQGU.
You are receiving this because you were mentioned.Message ID: ***@***.***>
----------------------------------------------------------------------
Felix Petriconi
email: ***@***.*** ***@***.***
----------------------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Locking can be avoided if the very last process is bound to a main_scheduler or you use a double-buffering mechanism that works purely with atomics.
… Amol Jadhav ***@***.***> hat am 28.02.2025 17:12 CET geschrieben:
This worked. However, updating the view will need me to share the window between the last process in the channel and the system. Would need some locking.
—
Reply to this email directly, view it on GitHub #560 (reply in thread), or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEVQGKKN2655M7T3RAF2VT2SCDGBAVCNFSM6AAAAABYBTICKOVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTEMZVGM3DAMI.
You are receiving this because you were mentioned.Message ID: ***@***.***>
----------------------------------------------------------------------
Felix Petriconi
email: ***@***.*** ***@***.***
----------------------------------------------------------------------
|
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
I'm trying to explore channels for one my requirement. I've a big processing pipeline (channels+processes) which prepares the view, and there is a window lifecycle (this window creation needs to be separate than the pipeline) which runs on main thread:
In the foreground state of this window, I want the channel's process to get received. To this window I gave copy of last
stlab::receiver<View>however, window doesn't get the view from the channel. This lifecycle is managed by System on the main thread.Here the foreground callback is not getting the view at all even if it is has been sent by the
stlab::sender. The creation of Window needs to be separate from the channels/processes preparing the view.How can I make the window wait and receive the View? I can't give it main_executor because that will cause deadlock because
foregroundis already on the main thread and needs the view.@FelixPetriconi @sean-parent
Beta Was this translation helpful? Give feedback.
All reactions