• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import {launch} from "std/concurrency"
17import {Job} from "std/core"
18
19class Example {
20    public static foobar(): Object {
21        return new Object();
22    }
23
24    public static baz(): Object {
25        return new Object();
26    }
27}
28
29function bar(x: int, y: float): Object {
30  return new Object();
31}
32
33function foo(x: int): Object {
34  launch<Object, (i:int,f:float)=>Object>(bar,x, 30);
35  return new Object();
36}
37
38function main(): void {
39  let p: Job<Object>;
40  p = launch<Object, (i:int) => Object>(foo, 11);
41  p = launch<Object, () => Object>(Example.foobar);
42  p = launch<Object, () => Object>(Example.baz);
43  p = launch<Object, () => Object>(Example.baz);
44  let foo_ref: (x: int) => Object = foo;
45  p = launch<Object, (i:int) => Object>(foo_ref, 5);
46  let lambda: () => void = (): void => { return; }
47  launch<void, ()=>void>(lambda);
48}
49