added option to emit yield/resume events