variable atomic operation in signal handler linux c

view story

http://stackoverflow.com – I have declare long long variable and update and checking the value in main routine. In signal handler, i am checking its value and updating value. Suppose if i make the operation atomic, during its update in main routine, i got signal handler, in signal handler if that variable is already in process of update, then signal handler is not updating the status. When control again come back, i lost the signal handler routine functionality. How can i avoid this? Regards. Learner (HowTos)