static Mutex mutex; function() { Guard guard(mutex); do_stuff; throw_exceptions; if (test()) return; etc; }