We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8f25285 commit fc640f7Copy full SHA for fc640f7
2 files changed
vlib/v/gen/c/array.v
@@ -1441,6 +1441,9 @@ fn (mut g Gen) gen_array_wait(node ast.CallExpr) {
1441
eltyp := g.table.sym(thread_ret_type).cname
1442
fn_name := g.register_thread_array_wait_call(eltyp)
1443
g.write('${fn_name}(')
1444
+ if node.left_type.is_ptr() {
1445
+ g.write('*')
1446
+ }
1447
g.expr(node.left)
1448
g.write(')')
1449
}
vlib/v/tests/concurrency/thread_wait_ptr_test.v
@@ -0,0 +1,18 @@
1
+import math { sqrt }
2
+import time
3
+
4
+fn get_hypot(a f64, b f64) f64 {
5
+ time.sleep(100 * time.millisecond)
6
+ c := sqrt(a * a + b * b)
7
+ return c
8
+}
9
10
+fn test_main() {
11
+ mut arr := &[]thread f64{}
12
+ for num in 1 .. 1000 {
13
+ g := go get_hypot(num, num)
14
+ arr << g
15
16
+ result := arr.wait()
17
+ assert result[0] == 1.4142135623730951
18
0 commit comments