understanding attachinterrupt in a pulse counter

Just to add -
That's the point of an interrupt.

Whatever the code is doing - as long as that interrupt is enabled - the trigger event will 'interrupt' the current instruction sequence, and then return to the same spot in code when the ISR has completed.

You don't have to do anything special to receive an interrupt - as long as you return from the ISR as quickly as possible - ready for another/next event.