Skip to content

[RFC] Use raw queue elements #3

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

Merged
merged 4 commits into from
Sep 22, 2020
Merged

[RFC] Use raw queue elements #3

merged 4 commits into from
Sep 22, 2020

Conversation

facchinm
Copy link
Collaborator

Copy link
Contributor

@aentinger aentinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think a better option for the scenario "queue full" would be to discard the oldest element and store the newest one. What do you think @pnndra @facchinm ?

@aentinger
Copy link
Contributor

Thank you for all your effort @facchinm (and sorry for me continueing to bother you 😉 ). There's one last wish I'd like to voice: Replace the do-it-yourself heap allocation via new/delete with SharedPtr. Smth along the following lines should work:

#include "platform/SharedPtr.h"
/* ... */
rtos::Queue<SharedPtr<T>, 16> queue;
/* ... */
Shared<T> obj(new T(val));
return (*obj);
/* ... */

@facchinm
Copy link
Collaborator Author

@aentinger can you provide a PR? I'm going to merge this one in the meantime 🙂

@aentinger
Copy link
Contributor

@facchinm Yes, that's probably a good idea 😆 I'll create an issue and assign it to myself.

@facchinm facchinm merged commit 08e5a56 into master Sep 22, 2020
@aentinger aentinger deleted the raw_queue_elements branch September 23, 2020 10:36
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.

Shared Variables queue issue
2 participants