Context
Espressif's embedded development libraries for the ESP32 microcontroller contain an event system based on FreeRTOS.
The event system handles connectivity, interrupts and other IO activity, but it's also extensible by the user. It's the latter part I'm interested in.
How is this extensible architectural pattern named?
How is this extendible event management architectural pattern named, in which the set of events can be extended, incorporated into my own API, and handled by the existing event loop (and its thread/task handling, integration, etc.)?
More details
With the current architectural design of that library, I can for example declare a new "class" of events and use them as part of my own code's APIs. In other code I can register event handlers and asynchronously receive these events, along with a payload of relevant data. My own code can then post events eg. on state changes, interrupts, or IO activity.
It is extremely simple in its interface eg. to declare a set of events for users of my library to listen for:
ESP_EVENT_DECLARE_BASE(MYLIB_EVENTS);
typedef enum {
MYLIB_EVENT_IT_STARTS,
MYLIB_EVENT_IT_ENDS,
} mylib_event_t;
To listen for events:
esp_event_handler_register(
MYLIB_EVENTS,
MYLIB_EVENT_IT_STARTS,
my_other_library_callback,
args
);
To post events:
esp_event_post(
MYLIB_EVENTS,
MYLIB_EVENT_IT_STARTS,
args, size_of_args,
/* maybe timeout, priority, etc. */
);
The most useful thing for me by far is being able to extend the set of events, incorporate them into my own API, and let the existing event loop (and its thread/task handling, integration, etc.) handle it all. I'm not as concerned with the IO side of things, what I really want the events for is interaction between libraries within a single process.
Why I need the terminology?
Espressif's library is written for the ESP32 using FreeRTOS. I would like to have a similar library for POSIX systems (still in C). I could roll my own with threads and synchronisation primitives, but using an established library is always preferable.
The problem is, I don't know what that is typically called, so I have no idea what to look for:
Searching for "event loop" or "event library" brings me to eg. libevent, libev, libuv. These do the event-based IO side of things, but aren't designed to be extended.
Searching for "library" + any of: "message passing", "message queue", "publish subscriber or "pubsub" etc. brings me to eg. zeromq, nng (ex. nanomsg). Again, these handle the IO but aren't easy to extend. Where message serialisation APIs are provided they is nowhere near as simple and transparent as the above.
Knowing the commonly accepted name of that kind of architecture would help me finding existing libraries, or advices to develop my own.