mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
24 lines
267 B
V
24 lines
267 B
V
import time
|
|
|
|
struct St {
|
|
mut:
|
|
x f64
|
|
}
|
|
|
|
fn f(x int, y f64, shared s St) {
|
|
time.sleep(50 * time.millisecond)
|
|
lock s {
|
|
s.x = x * y
|
|
}
|
|
return
|
|
}
|
|
|
|
fn test_go_return() {
|
|
shared t := &St{}
|
|
r := spawn f(3, 4.0, shared t)
|
|
r.wait()
|
|
rlock t {
|
|
assert t.x == 12.0
|
|
}
|
|
}
|