Please tell me how to organize it better.
There are two separate tasks simultaneously working. Everyone works in an infinite loop, that is, everyone works constantly.
The question is, how can I better organize a variable where 1 task would write, and the second and UI stream read?