Skip to content

6 DR 20230809_2

Manuel Hatzl edited this page Aug 18, 2023 · 5 revisions

Multithreaded Pub/Sub

Keywords: architecture, design

Participants: Manuel Hatzl

Central lists of subscriptions

All subscriptions are stored in two central lists, because a central location allows easier management of subscriptions. Two lists are needed, because one is for subscriptions to specific events, and the other one for subscriptions to all events.

Because the lists are shared globally, it was decided to have a public static variable that is used as publisher. This publisher is used to capture events, and manage subscriptions. The event handler thread, used to forward captured events to subscribers, is created, when creating the publisher.

Note: Since events should also be set on drop, it was decided to use macros to set up all necessary implementations for a new publisher.

Channels for communication

Synchronous channels from std::sync::mpsc are used for communication, because of the assumption that they have the least possible performance impact on capturing side. As mentioned in req:qa.perf, low performance impact on capturing side is more important than on the subscriber side.

REQ-Referencing Overview:

Last update: 2023-09-14_10:01 UTC
Branch: main
Commit: 98f71ca

Clone this wiki locally