The easiest is to use a flag or semaphore to store the last value of the input. you compare the current state with that, and only do the + when the input change from an old '0' to a new '1'. You store the new value as the flag, whenever there is a change. Using this procedure, you can implement a counter to debounce any glitches in your pushbutton. For example, you need to read the same value 3 times before changing state. To do this you will need an extra semaphore to store the intermediate state, and a counter.
Using a semaphore system, you don't have to wait for state changes, and your program will run even if the button is pushed.