Feasability: "disabling" a pushbutton while code is running

Before starting I would like to know the better way to "disable" a push button while the code is being executed.

Make reading the button state dependant on a boolean. Change the state of the boolean to enable/disable reading the state of the button.