int gVar = 0; void interrupt() { ... gVar = 1; } void f() { ... while(gVar == 0){ ... } ... }