OnceFlag
class OnceFlag
A resettable flag that runs a block at most once between resets.
The flag is set before the block is invoked, so a block that throws still consumes the flag and later calls do not run.
This class is not thread-safe.