Added ability to pass a function to loop executor that will get called right before the call to yield