I don’t know if you’ve tried much multithreading yet, but when you do, it’s important to consider thread safety. Namely, making sure you don’t try to access a variable on multiple threads at once. The means to achieve this is by locks such as mutual exclusions or mutexes.
For example, you could check out SFML’s sf::Mutex and sf::Lock. At some point, I’ll talk about thread safety in more detail!