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

Actor finalize function #60

Open
farresti opened this issue Jun 7, 2018 · 1 comment
Open

Actor finalize function #60

farresti opened this issue Jun 7, 2018 · 1 comment

Comments

@farresti
Copy link

farresti commented Jun 7, 2018

Would it be possible to add a finalize actor function symetrically to the init one ?
This function would be called at the end of the programm and could serve to close some file or stuff.

@ahonorat
Copy link
Contributor

Finalize functions are not supported yet.

Workarounds:

  • set atexit() of libc in one of the init function
  • set preesmStopThreads to 1 in one of the actor function (must be declared in the source code : extern int preesmStopThreads;)

Possible update of the codegen:

Authorize actor functions to return an int and check the value at each execution:

if (actorCode(/* inputs and outputs */) != 0) {
    properExit();
}

The properExit function would call all finalize functions in the graph topological order of the actors having a finalize function.

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

No branches or pull requests

2 participants