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
Uh oh!
There was an error while loading. Please reload this page.
-
$title will be achieved by
start-actionto be isolatedDefining a
start-actionto be isolatedA
start-actionwill be defined isolated, ifmethod-callorclient-remote-method-call-actionthe expression for the object is an isolated expressionA
start-actionis modeled as an action invocation in the compiler.ISOLATEDflag 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-actioncan run in a different thread from the current strand -@strand{thread:"any"}annotation will be added internally for the isolatedstart-actionat the desugar phase.An isolated function can contain an isolated
start-action- According to the current implementation, it is not allowed to havestart-actionin the body of an isolated function. But with this change, it will be allowed to have an isolatedstart-actionin 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-declin 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-declin an isolated function, a reference to a local variable outside thenamed-worker-declshould satisfy the same requirements as a captured variable in an isolated function/method.A worker is modeled as a lambda function in the compiler.
ISOLATEDflag 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-actionand named workersShould also support inferring the isolatedness of a
start-actionand a named worker.Highly appreciate your input on this discussion.
Beta Was this translation helpful? Give feedback.
All reactions