Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow the usage of "static queues" (based on std::array) for process_queue and defer_queue #615

Merged

Conversation

devzeb
Copy link
Contributor

@devzeb devzeb commented Mar 8, 2024

Problem:

All examples for sml::process_queue and sml::defer_queue are based on std::queue.
While this approach is fine for desktop c++, some use cases exist where dynamic allocations are not allowed / desired.

Some examples are:

  • embedded systems (no dynamic memory allocations available)
  • real-time systems with pre-allocated objects

As boost::sml is a library that targets embedded systems, it should allow the use of pre-allocated queues.

Solution:

I enabled the use of pre-allocated queues by making queue_event default constructible.
This allows storing instances of queue_event in a container that pre-allocates all elements upon construction (e.g.
std::array).

I added additional tests in actions_process.cpp, actions_defer.cpp and actions_process_n_defer.cpp that
use std::array based queues and deques.

…queues" (based on std::array)

added tests for sml::process_queue<> and sml::defer_queue<> with static queues
@kris-jusiak kris-jusiak merged commit 57f2e3e into boost-ext:master Mar 8, 2024
4 of 5 checks passed
@kris-jusiak
Copy link
Collaborator

Nice one, thanks @devzeb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants