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

Named worker that is statically guaranteed not to outlive its function #1096

Open
jclark opened this issue May 14, 2022 · 2 comments
Open

Named worker that is statically guaranteed not to outlive its function #1096

jclark opened this issue May 14, 2022 · 2 comments
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design

Comments

@jclark
Copy link
Collaborator

jclark commented May 14, 2022

It would be useful to be able to have a named worker that is guaranteed not to outlive the function that created it. This is not currently possible: even if the function worker waits for the named worker, the function worker may panic before the wait completes, and in that case, the named worker will outlive the function worker.

Two reasons why this is useful:

  • we can improve on Extend isolated concept to named workers #1095: a named worker in an isolated function can safely access mutable local variables and parameters that are in the function but outside the worker if it it can be guaranteed that the worker does not outlive the function (although the worker strands would all run on the same thread)
  • it's good thing generally (a basic principle of structured concurrency)
@jclark
Copy link
Collaborator Author

jclark commented Oct 25, 2023

If we were to use named workers to represent dataflow blocks, then it would be a real pain for named workers not to have full access to parameters.

@jclark
Copy link
Collaborator Author

jclark commented Nov 21, 2023

Also note that allowing workers to access mutable local variables (at the cost of the workers running on the same thread) would also be beneficial for dataflow, and would allow a less "pure" but perhaps more familiar expression of dataflow.

@anupama-pathirage anupama-pathirage added Type/Improvement Enhancement to language design Area/Lang Relates to the Ballerina language specification labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Lang Relates to the Ballerina language specification Type/Improvement Enhancement to language design
Projects
None yet
Development

No branches or pull requests

2 participants