v2 / vlib / v / gen / c / testdata / spawn_call_fn_struct_field.vv
18 lines · 14 sloc · 214 bytes · 87141195907f0458d2fca45fec6bed7b09948d26
Raw
1struct Foo {
2mut:
3 func1 fn (int) = unsafe { nil }
4 func2 fn (int) = do
5}
6
7fn do(a int) {
8 println('hello')
9}
10
11mut foo := Foo{}
12
13foo.func1 = do
14mut p := spawn foo.func1(1)
15p.wait()
16
17p = spawn foo.func2(1)
18p.wait()
19