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

#1670 adding static queue methods #1673

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

daveythacher
Copy link
Contributor

Adding static_queue_init and static_queue_init_spinlock. These accept a pointer to a static storage array. This allows using the queue API without calloc. Added null checks to queue logic also.

No testing performed.

@peterharperuk
Copy link
Contributor

Looks ok. We might want to protect queue_free so it does nothing if it memory was not allocated on the heap? And maybe add an example, although you can leave that to us.

@daveythacher
Copy link
Contributor Author

Queue free is a good point. Part of me wants to create a new type which forces a duplication of the API. Part of me says we could add a field to the queue structure. Overall I think we could point out in the documentation or example that queue free is not required for static queues. This is ambiguous, which can be problematic.

@peterharperuk
Copy link
Contributor

It might be possible to assert the memory is in the heap? But you can leave queue_free as it is for now.

@daveythacher
Copy link
Contributor Author

Any objections to removing the heap completely? (Probably more of a question for version 2.0 of the SDK.)

@peterharperuk
Copy link
Contributor

I think as much as we'd like to remove stuff we don't like, we're stuck with it for the time being.

@kilograham kilograham self-assigned this May 19, 2024
@kilograham kilograham added this to the 1.7.0 milestone May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants