Skip to content

v0.1.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@Oipo Oipo released this 06 Nov 19:34
· 173 commits to main since this release

Main Changes

  • Improve developer ergonomy:
    • Remove polymorphic allocator in favour of mimalloc
    • Change most pointers to references
  • Compiler support expanded:
    • Support clang 14 and up
    • Support gcc 11.3 and up
  • Implement co_await:
    • new AsyncGenerator class
    • Used in timers, RunFunctionEvent, http classes
  • Improve CI pipeline
  • Support added for configurable event queues
    • Multimap based
    • Sdevent based
    • User-defined ones
  • Optionally use google abseil

Examples

co_await

Ichor now supports using co_await to wait on a response on HTTP requests:

auto toSendMsg = _serializationAdmin->serialize(PingMsg{_sequence});
HttpResponse &response = *co_await _connectionService->sendAsync(HttpMethod::post, "/ping", {}, std::move(toSendMsg)).begin();

if(response.status == HttpStatus::ok) {
    auto msg = _serializationAdmin->deserialize<PingMsg>(response.body);
    co_return msg;
} else {
    co_return std::unique_ptr<PingMsg>{};
}

For more example code, please look at the ping pong example.

Different queue implementations

To instantiate the Multimap based queue:

#include <ichor/event_queues/MultimapQueue.h>

using namespace Ichor;

int main(int argc, char *argv[]) {
    // ...
    auto queue = std::make_unique<MultimapQueue>();
    auto &dm = queue->createManager();
    // ...
}

And the sdevent based one:

#include <ichor/event_queues/SdeventQueue.h>

using namespace Ichor;

int main(int argc, char *argv[]) {
    // ...
    auto queue = std::make_unique<SdeventQueue>();
    auto &dm = queue->createManager();
    dm.store(&dm, std::memory_order_release);

    auto *loop = queue->createEventLoop();
   // ...
    queue->start(DoNotCaptureSigInt);

    int r = sd_event_loop(loop);
    // ...
}