|
Multithreading and locking?
According to the documentation, "Task.h" provides a way to do multithreading on the robot. I wanted to try running my camera processing code on a separate thread and ping back on it periodically to grab the latest set of data it produces.
I'm pretty new to multithreading, but as best as I can tell, I need to lock a variable or something before I read/write to it to make sure things don't go haywire. However, I don't know how to lock a variable or otherwise communicate between a thread and the main program.
How would I accomplish this? If possible, could somebody point to some example code that does something similar so I can use it for reference?
|