You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can implement Send and Sync for Controller, but I'd like someone else to weigh in before I submit a PR. Send and Sync are not implemented automatically because Controller contains raw pointers.
I believe they are safe to implement because nothing in the Controller API gives access to its internal ws_2811_t C struct. Since it is the only thing that can access it, there is no possibility of pointer aliasing.
My use case is that I would like to initialize Controller and then create a thread that accepts messages via a channel and changes lights. Without implementing Send, I would have to initialize Controllerinside this thread, which means I can't handle initialization errors before spinning up the thread.
The text was updated successfully, but these errors were encountered:
Sorry for the late reply, but college finals just finished up so I'm finally able to spend some time programming fun things.
Basically, I'm not sure it can implement either safely due to the wrapping of the ws2811_t structs from the core library. It's not clear that either are valid assumptions about the memory managed by rpi_ws281x, and unfortunately since this library directly wraps an object managed by rpi_ws281x, we can't be sure without inspecting the C library, which will be some non-trivial amount of effort.
I think we can implement
Send
andSync
forController
, but I'd like someone else to weigh in before I submit a PR.Send
andSync
are not implemented automatically becauseController
contains raw pointers.I believe they are safe to implement because nothing in the
Controller
API gives access to its internalws_2811_t
C struct. Since it is the only thing that can access it, there is no possibility of pointer aliasing.My use case is that I would like to initialize
Controller
and then create a thread that accepts messages via a channel and changes lights. Without implementingSend
, I would have to initializeController
inside this thread, which means I can't handle initialization errors before spinning up the thread.The text was updated successfully, but these errors were encountered: