I have a public shared DateTime type variable called [LastAccessTime]. There are multiple work threads updating this variable to current time (Now). Normally, the DateTime variable is updated 10-100 times per second by work thread(s). The Main thread will read the variable value every three seconds. If the variable was not updated for 10 seconds, the main thread will take some actions
The value for this datetime variable is less critical to main thread. My question is: The work thread update the variable without synchronization control, does main thread always read either old value or new value? I just worry main thread may read some bad value like Null, or the time of one hundred years before, because work thread updates are not atom
I also have a 20K length byte array. Because CPU may take more time to update it, so I control it with a ReaderWriterLock. If I don’t care of the value of old or new value (not other value), can I get rid of ReaderWriterLock
Thanks