Original Post
Let''s say I''m creating a thread to listen for some input. When a keypress or some such occurs, the thread places that value in a variable. It is the only thing that will write to this variable. Somewhere else, there''s a function that will read the variable''s value. All this function can do is read the value of the variable.
Do I need to use semaphores or some such technique to make sure that there are no collisions? And even if reading and writing at the same time do cause a collision, will it be fatal to the program, or just produce some ugly value?