If one is in middle of learning and interrupting will cause them to have to return to the beginning of the sugya in order to remember what they learnt, then one need not interrupt until they finish the topic. However, in all cases where one is feeling immediate pressure, one must interrupt their Shmoneh Esrei or learning to relieve themselves.