1

pthread does not seem to use updated global data value

view story
linux-howto

http://stackoverflow.com – I am new to threads. I want to make two threads xthread prints 'X'; and ythread prints 'Z'; continuously until the user inserts 'C' or 'c' at stdin. I have made use of select to check if there is any userinput. If there is a userinput I use scanf to obtain it in read and do the comparison. I have kept read as global. [Is there any other way of sharing non-global data between threads? ] . I have assumed that, when the user enters 'c' at stdin the thread which is currently running reads it and stores it in read and breaks out. I have used the flag read_input to indicate to other threads that in (HowTos)