all: fix references to time.wait -> time.sleep

pull/9017/head
Delyan Angelov 2021-02-28 18:01:31 +02:00
parent bdce35fd9c
commit 4125bfe401
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
5 changed files with 20 additions and 20 deletions

View File

@ -2579,7 +2579,7 @@ import time
fn task(id int, duration int) {
println('task $id begin')
time.wait(duration * time.millisecond)
time.sleep(duration * time.millisecond)
println('task $id end')
}
@ -3868,7 +3868,7 @@ fn print_message() {
fn main() {
for {
print_message()
time.wait(500 * time.millisecond)
time.sleep(500 * time.millisecond)
}
}
```

View File

@ -31,10 +31,10 @@ import benchmark
mut b := benchmark.start()
// your code section 1 ...
time.wait(1500 * time.millisecond)
time.sleep(1500 * time.millisecond)
b.measure('code_1')
// your code section 2 ...
time.wait(500 * time.millisecond)
time.sleep(500 * time.millisecond)
b.measure('code_2')
```

View File

@ -8,7 +8,7 @@ mut:
fn (shared x St) f(shared z St) {
for _ in 0 .. reads_per_thread {
rlock x { // other instances may read at the same time
time.wait(time.millisecond)
time.sleep(time.millisecond)
assert x.a == 7 || x.a == 5
}
}
@ -65,10 +65,10 @@ fn test_shared_lock() {
for i in 0 .. writes {
lock x { // wait for ongoing reads to finish, don't start new ones
x.a = 17 // this value should never be read
time.wait(50 * time.millisecond)
time.sleep(50 * time.millisecond)
x.a = if (i & 1) == 0 { 7 } else { 5 }
} // now new reads are possible again
time.wait(20 * time.millisecond)
time.sleep(20 * time.millisecond)
}
// wait until all read threads are finished
for finished := false; true; {
@ -80,6 +80,6 @@ fn test_shared_lock() {
if finished {
break
}
time.wait(100 * time.millisecond)
time.sleep(100 * time.millisecond)
}
}

View File

@ -9,7 +9,7 @@ mut:
fn (shared x St) f(shared z St) {
for _ in 0 .. reads_per_thread {
rlock x { // other instances may read at the same time
time.wait(time.millisecond)
time.sleep(time.millisecond)
assert x.a == 7 || x.a == 5
}
}
@ -63,11 +63,11 @@ a: 5
for i in 0..writes {
lock x { // wait for ongoing reads to finish, don't start new ones
x.a = 17 // this value should never be read
time.wait(50* time.millisecond)
time.sleep(50* time.millisecond)
x.a = if (i & 1) == 0 {
7} else {5}
} // now new reads are possible again
time.wait(20*time.millisecond)
time.sleep(20*time.millisecond)
}
// wait until all read threads are finished
for finished:=false;; {
@ -79,6 +79,6 @@ for finished:=false;; {
if finished {
break
}
time.wait(100*time.millisecond)
time.sleep(100*time.millisecond)
}
}

View File

@ -57,7 +57,7 @@ fn main() {
if s == 'STOP' {
break
}
time.wait(delay * time.millisecond)
time.sleep(delay * time.millisecond)
}
pmessage()
pmessage()