Closed patchedByBatman closed 12 months ago
@gunturiCM what is the status of this issue? Should we close it?
@gunturiCM @jamie-54 do you need this issue? Shall we close it? By the way, if you need to keep notes somewhere, you can use the discussions page.
Hello sir, these notes can be useful in the future. For now, the Scheduler
class handles these tasks. If ROS were to be used, these notes become obsolete. I am closing this for now.
@gunturiCM OK, thank you. You can put it in the discussions section.
Tips regarding multi-threading in R-Pi
.join()
and manage threads usingThreadPoolExecutor
as a context manager for multi-threading tasks such as altitude hold, and loitering algos for future usage.ThreadPoolExecutor
will not report it, so might want to handle exceptions properly in the threaded functions.thread_1
needs results ofthread_2
, so the required order of execution is to startthread_2
, let it finish, startthread_1
, let it finish. But pooling threads 1 and 2 cannot guarantee which of the two runs first. It becomes worse if they share resources, as one might not be aware that the other changed some values in the shared resource (not thread-safe). A possible solution is to use Locks (but make sure to release them).