This may sound basic for a question but I never had a formal (if there is) answer to it.
What is the best way (efficient way) to go about synchronizing the following:
Thread 1: while(1) read(shared_data)
Thread 2: while(1) lock(shared_mutex) write(shared_data) unlock(shared_mutex)
If what Thread 1 only does is read the data, does it need to lock the mutex too ? or just the write thread needs to do that ?
Thanx
shared_data?