Replies: 3 comments 2 replies
-
@lasinicl If the code contains @strand{thread:"any"} to a non isolated start action or named worker will that be a compilation error? |
Beta Was this translation helpful? Give feedback.
2 replies
-
/unsubscribe 😝 |
Beta Was this translation helpful? Give feedback.
0 replies
-
When
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
$title will be achieved by
start-action
to be isolatedDefining a
start-action
to be isolatedA
start-action
will be defined isolated, ifmethod-call
orclient-remote-method-call-action
the expression for the object is an isolated expressionA
start-action
is modeled as an action invocation in the compiler.ISOLATED
flag will be added for the invocation at the IsolationAnayzer if it satisfies the above conditions, so that can be identified as an isolatedstart-action
.The strand created by an isolated
start-action
can run in a different thread from the current strand -@strand{thread:"any"}
annotation will be added internally for the isolatedstart-action
at the desugar phase.An isolated function can contain an isolated
start-action
- According to the current implementation, it is not allowed to havestart-action
in the body of an isolated function. But with this change, it will be allowed to have an isolatedstart-action
in an isolated function and the compilation errors will be updated to reflect the invalid invocations.Extending isolated concept to named workers
An isolated function can contain a
named-worker-decl
- According to the current implementation, it is not allowed to have anamed-worker-decl
in the body of an isolated function. But with this change, it will be allowed to have an isolated worker in an isolated function and the compilation errors will be updated to reflect the invalid worker declarations.When a named worker is isolated its body will have similar restrictions to an isolated function (https://ballerina.io/spec/lang/master/#isolated_functions). Within a
named-worker-decl
in an isolated function, a reference to a local variable outside thenamed-worker-decl
should satisfy the same requirements as a captured variable in an isolated function/method.A worker is modeled as a lambda function in the compiler.
ISOLATED
flag will be added for the lambda function at the IsolationAnayzer if it satisfies the above conditions, so that can be identified as an isolated worker.The named worker's strand will run on a separate thread from the function's strand -
@strand{thread:"any"}
annotation will be added internally for the isolated worker at the desugar phase.Isolated inference for
start-action
and named workersShould also support inferring the isolatedness of a
start-action
and a named worker.Highly appreciate your input on this discussion.
Beta Was this translation helpful? Give feedback.
All reactions