Run/Step/Pause/Resume
Opened this issue · 6 comments
looks like the EventWaitHandle blocks the thread, use AsyncFactory.FromWaitHandle ?
Hi @richorama,
I think I come up with solution, check this branch, sorry for the major refactor, I was jumping around one file so much I split it to class per file. also added .editorsettings to make sure the formatting is uniform.
I split the IBlock.Evaluate to 3 steps:
- void BeforeEvaluate(Context context);
- object EvaluateInternal(Context context);
- void AfterEvaluate(Context context);
- public event BeforeAfterBlockDelegate BeforeEvent;
- public event BeforeAfterBlockDelegate AfterEvent;
Those are triggered as expected at the beginning/end of a block.
To Step/Pause the execution check the RunnerContext, the BeforeEvent is hitting semaphore that is feeded by Step() function
Let me know what you think, I want to clean it up (some of the naming I think can be better) and add tests.
Maciej
Great idea. I was wondering about support some kind of middleware (or multiple middleware) functions in a similar kind of approach. Would be useful for adding telemetry/profiling as well.
@maciejmatuszak Are you still playing this?
No longer have time to play with it but I got it to reasonable shape. check out this branch: block_before_after
and refactoring of variable access on top of that: variable_access
: maciejmatuszak/IronBlock@master...maciejmatuszak:variable_access
How was this? Is there a way to pause/cancel code evaluation?