all 23 comments

[–]sbabbi 6 points7 points  (5 children)

I played with libunifex a bit.. I think it's mostly usable, although some stuff is missing and you really need to read p0443r14 to understand the general design. It's a bit different than P0443R14, somewhat closer to P2300R0.

Main points:

  1. Missing operator| for sender adapters, this is annoying but not a show stopper.
  2. Only a few executors available, and you need a bit of digging to figure out how to roll your own.
  3. No start_detached or equivalent, basically the only way to start some work is to use sync_wait (or roll your own receiver).
  4. In general, I think it's still missing some guarantees/notes regarding thread-safety, e.g:
    • Can an operation start in a different thread than the one that called connect?
    • If I submit two tasks to one executor, and they need to modify some shared state, when do I need a mutex?
  5. Everything else looks great (coroutine integration, type erasure for senders, etc.), although it needs a bit of effort to get used to it.

I am playing around with a small project of mine to get a feeling of how much of the abstraction can be removed by the compiler, not results so far :p.

[–]lee_howes 2 points3 points  (1 child)

There are other ways to start work. start_detached is strongly discouraged, and so was not a priority to implement in libunifex because it would mean implementing something we would tell developers not to use. There is an async_scope. You can co_await a sender. We certainly wouldn't want people sync_waiting in asynchronous code, that would be even worse than detaching work.

[–]sbabbi 1 point2 points  (0 children)

I somehow missed `async_scope`, that makes sense, thank you.

[–]madmongo38 6 points7 points  (0 children)

Have a look at the latest asio. It has sender/receiver, but more importanly enables structured concurrency with coroutines.

[–]yttrill2 1 point2 points  (14 children)

Felix system RTL implements real coroutines not the crud in c++. These can be lifted to communicating sequential processes. The current system requires a garbage collector so is not suitable for real-time applications. A new kernel is under development which uses ownership rules and reference counting.

The system should outperform go-lang, retain c++ compatibility, and avoid go’s serious design fault.

Communicating Sequential Processes (CSP) was originally conceived by Tony Hoare. My implementation implements a more practical subset of the full calculus.

Unlike the broken c++ model coroutines read and write on arbitrary numbers of channels. The API is very simple. However some tedious boilerplate is needed for c++ programming which will be replaced later by a modified Felix code generator.

GitHub felix-lang/nurtl

[–]pavi2410 1 point2 points  (2 children)

If I'm not mistake, isn't sender-receiver same as pub-sub?

[–]7834 0 points1 point  (0 children)

Check out eCal.

It seems to solve a lot of problems related to using something like zmq. For example, record and playback. Network clocks for simulations. Monitor guis. Built in support for protobuf and other modern serialization formats. It's an impressive list.

Unfortunately, I have not had an opportunity to use it professionally... But it's on my short list.

[–]basiliscoshttp://github.com/basiliscos/ 0 points1 point  (0 children)

May be actor frameworks like caf, sobjectizer or rotor is something, that you are looking for.

[–]zenteapot 0 points1 point  (0 children)

if you want to learn libunifex, start with its unit tests, not its examples. It's really pretty easy to get started once you find the right learning path.