| 1 | import time |
| 2 | |
| 3 | struct St { |
| 4 | mut: |
| 5 | x f64 |
| 6 | } |
| 7 | |
| 8 | fn f(x int, y f64, shared s St) { |
| 9 | time.sleep(50 * time.millisecond) |
| 10 | lock s { |
| 11 | s.x = x * y |
| 12 | } |
| 13 | return |
| 14 | } |
| 15 | |
| 16 | fn test_go_return() { |
| 17 | shared t := &St{} |
| 18 | r := spawn f(3, 4.0, shared t) |
| 19 | r.wait() |
| 20 | rlock t { |
| 21 | assert t.x == 12.0 |
| 22 | } |
| 23 | } |
| 24 |