Leont / actor--

A header-only C++17 type-safe actor model threading library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a header-only C++17 library implementing actor-based threading.

Messages can be send using the send method, taking zero or more arguments:

  handle.send(1, "foo"s);

And received using the receive function:

  receive(
    [] (int number, const std::string& description) {
      // ...
    },
    [] (const some_object&) {
      // ...
    },
    [] (stop) {
      // stop the loop
    }
  );

Receive will match each message against each selector, and will return when it finds a match. One can also receive with a timeout.

A more extensive example can be found in the examples/ folder, along with its erlang equivalent (taken from the Debian language shoot-out).

This software may by used and distributed under the ISC licence

About

A header-only C++17 type-safe actor model threading library

License:ISC License


Languages

Language:C++ 93.0%Language:Makefile 7.0%