Std::execution as an alternative to libsigc++

Did you (at gtkmm) consider supporting std::execution as an alternative to libsigc++?
std::execution will be in C++26 but until then a library could be used: stdexec or libunifex.

I wrote a usage example at https://codeberg.org/Phosit/stift/src/branch/main/examples/application_window/main.cpp

I was kicking the tires on it last year. Here is an example (I’ve chosen the line number so the discourse preview shows an interesting section).

Basically I call curl’s blocking api in a thread, then transfer the result to the gtk thread mainloop.

I intend to make a more in depth example repo at some point, once I see that nvidia/stdexec has exactly whats approved for c++26.

This is not exactly what i propose.

You launch an execution when the button is clicked. And when it’s finished the continuation is executed…

I don’t think that this is what structured concurrency strives for. Maybe that’s due to the shortness of the example.

I want to integrate it deeper. Like that the button itself returns a sender (or a sender-adaptor).

In the end (and when using coroutines) i want to write no callbacks.

After more reading i think that it has the same goal as i have.

Do you have plans to integrate it in glibmm?

Its been some time since I was in the particulars, but I believe I came to a conclusion that sigc++ signals/signalproxys could be annotated with some typedefs and maybe an additional method which would allow them to qualify as senders.

I don’t plan to make any serious efforts until std::execution is in the gnu stdlib c++ and there is good documentation (at least on cppreference). So that’s definitely a year or two off still. I recall struggling a lot to find documentation from the nvidia library. And so many conference talks on execution are like “You only need to understand senders to use them, there’s no need to worry about receivers or such (…unless you’re a library developer…).”

Given the conversation I am motivated to flesh out this example repo a little more. I want to have the example app show cancellation and error reporting in action. And I did also want to show using coroutines in gtkmm with senders as well. But I’m going overseas tomorrow, so it will be a while before I make any progress again.

That said, gtkmm’s maintainer has been saying for a while that he wants to retire. If senders can really be added with a few typedefs and tag_invoke then I guess it has a shot at being merged. But a big restructuring of all the async methods seems unlikely unless a new maintainer pops up and wants to support it.

I think about making a branch of gtkmm (with stdexec) and merge it back when std::execution is supported by gcc.

Just a quick note, today nvidia’s stdexec has made a new 25.09 release. Thankfully it doesn’t throw compilation errors. I’ve updated my repo to use it and made a couple other fixes. It runs fine on gcc 15 & gtkmm 4.18 now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.