-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
spinlock APIs need documentation #20993
Comments
Spinlocks are valid when zero-initialized. The normal use case is to put it in bss, but if you want to use a local you can do " |
seems like spin lock is in general missing any documentation. no doxygen for Line 67 in 21e0d48
|
@andyross can you please add missing documentation? |
I don't think the documentation added in #25092 actually addresses the main issue here: There is no init API and there is no part of the added documentation that states the memory must be initialised in any way (as far as I can tell). I encountered this in a spin lock that was allocated by k_malloc, which had actually worked for some time in our system, and then when some code was moved around, it started failing oddly with this, because the pre-existing memory contents happened to be different for the new location. In the old location it just happened to be zero, and nothing bad happened. |
Describe the bug
When using spin lock in a following code:
I'm hitting assert in
z_spin_lock_valid
.zephyr/include/spinlock.h
Line 79 in 21e0d48
k_spin_lock
is validating lock structure which might not be initialize and validation includes checking one of the fields of uninitialized structure. I'm not sure then ifstruct k_spinlock
should be somehow initialized before being used? If so, i don't see any init function. What about single core case?The text was updated successfully, but these errors were encountered: