Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run/Step/Pause/Resume #38

Open
maciejmatuszak opened this issue Dec 11, 2020 · 6 comments
Open

Run/Step/Pause/Resume #38

maciejmatuszak opened this issue Dec 11, 2020 · 6 comments

Comments

@maciejmatuszak
Copy link

Add ability to Run/Step/Pause/Resume at block granularity

depends on #36 #37

  • possibly use ManualResetEvent as mechanism to pause/resume
  • possibly use AutoResetEvent for step
  • can the base EventWaitHandle be used for both?
@maciejmatuszak
Copy link
Author

looks like the EventWaitHandle blocks the thread, use AsyncFactory.FromWaitHandle ?

@maciejmatuszak
Copy link
Author

maciejmatuszak commented Jun 10, 2021

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);

The Context has now 2 events:

  • 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

@richorama
Copy link
Owner

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.

@yuzd
Copy link

yuzd commented Dec 1, 2021

@maciejmatuszak Are you still playing this?

@maciejmatuszak
Copy link
Author

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

@danijerez
Copy link

How was this? Is there a way to pause/cancel code evaluation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants