-
Notifications
You must be signed in to change notification settings - Fork 17
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
how can I access to a ringBuffer as a pointer #17
Comments
Hello. You mean you want to take a pointer on a ring buffer object ? best regard |
My idea is that I want to get it as a function parameter as a pointer. How can I do this? |
Do it as you do for any other data type but I suggest you pass it as reference instead of pointer.
|
A full example with both reference and pointer |
Ok, thank you! Now I understood. |
Hello. You can access it on different threads (I suppose you mean FreeRTOS tasks) as variable. Using a pointer will not make any difference because in the end the race condition will occur in the buffer storage, not in the way the code accesses the storage. However, if you use you have to use a semaphore to prevent preemption. A binary semaphore is ok. Your code hase to take it before calling any function of the ring buffer and release it after. |
Hi, I would like to access this RingBuffer as a pointer. Does this solution have such an option?
The text was updated successfully, but these errors were encountered: