Data are not "inside threads". Data live in memory, and any thread can read/write that memory. Threads are not "locked", but they can explicitly wait until some resource (data) becomes available.
You can use synchronization primitives, the simplest being the mutex, to ensure safe access to these shared locations in memory between threads.
I suggest that read more about multithreading and concurrent access, these are the basics of multithreading programming. Trying to write multithreaded code without fully understanding this is only going to cause you troubles