Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
C

cpp-rotor

> 编程语言
Open source

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

390 stars0 likes0 views
WebsiteGitHub

About

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

Rotor

rotor is event loop friendly C++ actor micro framework, sourcecraft github abf

telegram

features

  • minimalistic loop agnostic core
  • erlang-like hierarchical supervisors, see this and this
  • various event loops supported (wx, boost-asio, ev) or planned (uv, gtk, etc.)
  • asynchronous message passing interface
  • request-response messaging with cancellation capabilities, see
  • MPMC (multiple producers multiple consumers) messaging, aka pub-sub
  • cross-platform (windows, macosx, linux)
  • inspired by The Reactive Manifesto and sobjectizer

messaging performance

inter-thread (1) cross-thread (2) single thread (3) no alloc, TS (4) no alloc (5)
~31.6M msgs/s ~2.5M msgs/s ~49.6М msgs/s ~34.9M msgs/s ~71.33M msgs/s

Setup: Intel Core i7-1360P, Void Linux, 6.12.63

(1) Backend-independent; Can be measured with examples/boost-asio/ping-pong-single-simple, examples/ev/ping-pong-ev.

(2) Does not apply to wx-backend; can be measured with examples/thread/ping-pong-thread, examples/boost-asio/ping-pong-2-threads, examples/ev/ping-pong-ev-2-threads.

(3) Backend-independent inter-thread messaging when build with ROTOR_BUILD_THREAD_UNSAFE=True. rotor objects (messages and actors) cannot be accessed from different threads, cross-thread message sending facility cannot be used. This option is mainly targeted for single-threaded apps.

(4) Thread-safe pre-allocated single message inter-thread ping-pong'ing, see examples/thread/ping-pong-no-alloc.cpp using redirect() technique intoduced in v0.36 .

(5) Thread-unsafe (ROTOR_BUILD_THREAD_UNSAFE=True) pre-allocated single message inter-thread ping-pong'ing, see examples/thread/ping-pong-no-alloc.cpp using redirect() technique intoduced in v0.36 .

license

MIT

documentation

Please read tutorial, design principles and manual here

embedded

Looking for something actor-flavored, but suitable for embedded applications? Take a look into tardigrade project of my friend or rotor-light. To my opinion tardigrade is a bit better designed and should be considered first.

Changelog

0.41 (18-May-2026)

  • [bugfix] avoid race in registry plugin during shutdown
  • [bugfix] avoid race in link_client plugin during shutdown
  • [bugfix] avoid race in supervisor during requests discarding

0.40 (27-Dec-2025)

  • [doc] update synthetic performance metrics
  • [bugfix] [thread-backend] decrease cpu usage
  • [example] added examples/thread/ping-pong-no-alloc.cpp (use message redirection/no alloctions)
  • [cmake] copy compile_commands.json only for Makefile generator
  • [ci] use sourcecraft hosting platform as CI/CD friendly
  • [ci] fix appveyor windows builds

0.39 (19-Dec-2025)

  • [cmake, bugfix] export compile_commands.json only if cmake version is >= 3.29 (more correct fix, thanks to @ErniGH)

0.38 (17-Dec-2025)

  • [cmake, bugfix] export compile_commands.json only if cmake version is >= 3.29

0.37 (14-Dec-2025)

  • [feature, asio, thread, ev] allow poll-duration to be set to zero save CPU cycles/battery
  • [cmake, breaking] increase cmake version requirement 3.15 -> 3.17
  • [cmake] generate file for clangd langserv (thanks for @rymdbar)
  • [cosmetic] removed trailing spaces (thanks for @rymdbar)
  • [cosmetic] fixed identation to make sources more vim-folding friendly (thanks for @rymdbar)
  • [cosmetic] configure linters to project style (thanks for @rymdbar)

0.36 (14-Oct-2025)

  • [feature] add route() and redirect() high-level actor methods, which provide convenient API over make_routed_message() introduced in v0.32

0.35 (07-Oct-2025)

  • [breaking] asio supervisor uses steady clock instead of system clock (aka deadline_timer)

0.34 (25-Mar-2025)

  • [feature] improve c++20 support
  • [workaround, fltk] more realiable message delivery for fltk backend. Fltk might "forget" to invoke scheduled awakes after shutdown process, which leads to minor memory leaks
  • [cmake, breaking] use CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR
  • [cmake, breaking] configure option renamed BUILD_BOOST_ASIO => ROTOR_BUILD_ASIO
  • [cmake, breaking] configure option renamed BUILD_WX => ROTOR_BUILD_WX
  • [cmake, breaking] configure option renamed BUILD_EV => ROTOR_BUILD_EV
  • [cmake, breaking] configure option renamed BUILD_FLTK => ROTOR_BUILD_FLTK
  • [cmake, breaking] configure option renamed BUILD_THREAD => ROTOR_BUILD_THREAD
  • [cmake, breaking] configure option renamed BUILD_DOC => ROTOR_BUILD_DOC
  • [cmake, breaking] configure option renamed BUILD_THREAD_UNSAFE => ROTOR_BUILD_THREAD_UNSAFE
  • [cmake, new] configure option added ROTOR_BUILD_TESTS (instead of ENABLE_TESTING)

0.33 (26-Jan-2025)

  • [cmake, bugfix, win32] add ws2_32 lib for rotor_asio win32 build

0.32 (18-Dec-2024)

  • [feature] added make_routed_message() free function. The function is used for "synchronized" message post-processing, i.e. once a message has been delivered and processed by all recipients (can be zero), then it is routed to the specifed address to do cleanup.

Example:

  1. an db-actor and opens transaction and reads data (i.e. as std::string_views, owned by db)
  2. actors sends broadcast message to all interesting parties to deserialized data
  3. after the step 2 is finished the db-actor closes transaction and releases acquired resources.

The make_routed_message is needed to perform recipient-agnostic 3rd step.

The alternative is to create a copy (snapshot) of data (i.e. std::string instead of std::string_view), but that seems redundant.

  • [improvement, breaking] add void* parameter to message_visitor_t

0.31 (18-Oct-2024)

  • [bugfix, fltk] more realiable message delivery for fltk backend

0.30 (23-Apr-2024)

  • [feature] added fltk-backend
  • [feature, conan] enable_fltk option which add fltk-support
  • [example] added /examples/ping-pong-fltk.cpp and examples/ping-pong-fltk_and_thread.cpp
  • [bugfix] wx-backend building and testing
  • [improvement, breaking] output directories are set to bin for cmake
  • [improvement, breaking] actor_base_t::make_error() is marked as const

0.29 (24-Feb-2024)

  • [bugfix] fix segfault in delivery plugin in debugging mode (try to set env ROTOR_INSPECT_DELIVERY=99 to see)

0.28 (22-Jan-2024)

  • [cmake, bugfix] add missing header into installation

0.27 (21-Jan-2024)

  • [feature] new interface message_visitor_t
  • [feature] new interface message_stringifier_t and the default implementation default_stringifier_t which allows to dump messages. It is not a production but a diagnostic/debug tool, due to performance restrictions.
  • [feature] system_context_t provides a reference to default message_stringifier_t; it is possible to have a custom one
  • [feature, breaking] extended_error_t holds a reference to a request message, which caused an error
  • [examples, tests, win32] fix ev examples and tests
  • [example] modernize examples/thread/sha512.cpp to use recent openssl version
  • [breaking] cmake requirements are lowered to 3.15
  • [breaking] fix minor compilation warnings

0.26 (08-Jan-2024)

  • [feature] start_timer callback not only method, but any invocable
  • [feature, conan] enable_ev option which add libev
  • [breaking, conan] boost minimum version 1.83.0
  • [testing, conan] remove catch2 from sources and make it dependencies
  • [bugfix, breaking] make plugins more dll-friendly
  • [breaking] cmake minimum version 3.23
  • [breaking] rename registry_t::revese_map_t revese_map -> registry_t::reverse_map_t reverse_map
  • [breaking] rename struct cancelation_t -> cancellation_t
  • [doc] fix multiple typos

0.25 (26-Dec-2022)

  • [bugfix] avoid response messages loose their order relative to regular message
  • [bugfix, example] add missing header

0.24 (04-Jun-2022)

  • [feature] improve inter-thread messaging performance up to 15% by using boost::unordered_map instead of std::unordered_map
  • [bugfix, breaking] avoid introducing unnecessary event loops latency by intensive polling of rotor queues; affects asio and ev loops
  • [bugfix] registry_plugin_t, allow to discover aliased services (#46)

0.23 (23-Apr-2022)

  • [bugfix] fix compilation issues of messages.cpp on some platforms
  • [bugfix, msvc] fix compilation issues of registry plugin for shared library on msvc-16+

0.22 (21-Apr-2022)

  • [feature] possibly to install via conan center
  • [feature, breaking] possibility to build rotor as shared library
  • [feature] add shutdown flag checker (see my blog)
  • [bugfix] requests do not outlive actors (i.e. they are cancelled on shutdown_finish)
  • [example] there is my another open-source project syncspirit, which uses rotor under hood. I recommend to look at it, if the shipped examples are too-trivial, and don't give you an architectural insight of using rotor.

0.21 (25-Mar-2022)

  • [improvement] preliminary support of conan package manager
  • [bugfix] fix compilation warnings on Windows/MSVC
  • [bugfix] add missing header for rotor::thread installation

0.20 (20-Feb-2022)

  • [improvement] superviser can create spawner, which has a policy to auto-spawns new actor instance if previous instance has been shutdown. This is similar to escalate_failure supervising in erlang, see dedicated article
  • [improvement] actor can now autoshutdown_supervisor(), when it shutdown
  • [improvement] actor can now escalate_failure(), i.e. trigger shutdown own supervisor when it finished with failure
  • [improvement] messages delivery order is persevered per-locality (see issue #41)
  • [example] examples/thread/ping-pong-spawner (new)
  • [example] examples/autoshutdown (new)
  • [example] examples/escalate-failure (new)
  • [documentation] updated Design principles
  • [documentation] updated Examples
  • [documentation] updated Introduction

0.19 (31-Dec-2021)

  • [improvement] performance improvement in inter-thread (+20%) and cross-thread messaging
  • [bugfix] supervisor does not shut self down in rare cond

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++actoractor-frameworkasioboost

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言