What are some candidate libraries for inter-thread communication like message boxes or event systems?

This page summarizes the projects mentioned and recommended in the original post on /r/cpp

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • sobjectizer

    An implementation of Actor, Publish-Subscribe, and CSP models in one rather small C++ framework. With performance, quality, and stability proved by years in the production.

  • I was looking at SObjectizer as a message box provider, and it seems well designed and the API is nice, but I'm not sure how to go about retro-fitting it into an existing application, since all my threads already exist and I don't really want to change them all into SO "Agents", and I also don't see how to integrate the Dispatcher. I think it's worth a look though, if anyone with experiecne can confirm it is appropriate.

  • Aeron

    Efficient reliable UDP unicast, UDP multicast, and IPC message transport

  • If low latency / performance is important then something like aeron: https://github.com/real-logic/aeron or the disruptor pattern: https://github.com/Abc-Arbitrage/Disruptor-cpp are good options. Aeron supports network message but requires a driver to be running on the system even for IPC. Disruptor is thread to thread messaging only and doesn't need drivers etc - just a normal library.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • mqtt_cpp

  • If it's of any interest, the MQTT Client I am using is mqtt_cpp which, because it's built on ASIO, is able to handle publications from any thread in a thread-safe manner via an ASIO post. But as far as I can see it doesn't provide any kind of multi-thread-aware subscription/receipt.

  • so5-dining-philosophers

    Several implementations of solutions for "Dining Philosophers" problem built by using Actor and CSP models on top of SObjectizer framework

  • I want to note that SObjectizer provides not only agents and dispatchers for them, there is also such a thing as message chains. They were introduced specially for the integration of non-SObjectizer-parts of an application with SObjectizer-part. But since then they grew to a full-fledged mechanism of building multithreading applications even without agents. You can take a look at our dining-philosophers demo (the description, the repository).

  • mosquitto_transport

    mosquitto_transport is an experiment of writing SObjectizer-based wrapper around mosquitto library.

  • PS. Five years ago we used MQTT+SObjectizer in one of our projects, a part of it is available as [mosquitto_transport](https://github.com/Stiffstream/mosquitto_transport). You can take a look at it and get an idea of how MQTT and SObjectizer can be integrated together (maybe it's not a best way, but that approach worked well for us).

  • rotor

    Event loop friendly C++ actor micro-framework, supervisable

  • rotor actor library (I'm the author) was designed to solve similar problem, which I named "actor intrusiveness", when almost every piece of code should be written in form of actor, and, the working threads, which spin actors, are out of your control.

  • copper

    Port of Golang channels to C++ (by atollk)

  • In the meantime, are you aware of any projects that are similar? Have you come across copper? It looks nicely designed - is this the kind of thing you imagine would be similar?

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • RxCpp

    Reactive Extensions for C++

  • Also you can check rxcpp with documentation about reactive approach there. It is functional version of observer/publisher-subscriber patterns with ability to be multithreaded. You can send events from one side, subscribe from another and modify events in meanwhile

  • Rx.NET

    The Reactive Extensions for .NET

  • Also you can check rxcpp with documentation about reactive approach there. It is functional version of observer/publisher-subscriber patterns with ability to be multithreaded. You can send events from one side, subscribe from another and modify events in meanwhile

  • Disruptor-cpp

    Port of LMAX Disruptor to C++

  • If low latency / performance is important then something like aeron: https://github.com/real-logic/aeron or the disruptor pattern: https://github.com/Abc-Arbitrage/Disruptor-cpp are good options. Aeron supports network message but requires a driver to be running on the system even for IPC. Disruptor is thread to thread messaging only and doesn't need drivers etc - just a normal library.

  • benchmarks

    Latency benchmarks for messaging (by real-logic)

  • https://github.com/real-logic/Aeron/wiki/Performance-Testing https://github.com/real-logic/benchmarks

  • BlockingCollection

    C++11 thread safe, multi-producer, multi-consumer blocking queue, stack & priority queue class

  • I wasn't aware of copper; that looks pretty slick if you're able to pivot to that paradigm of thread interaction. I had played around with BlockingCollection at some point in the past.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts