1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vlib: improvements to the context module (#18318)

This commit is contained in:
Ulises Jeremias Cornejo Fandos
2023-06-04 13:12:52 -03:00
committed by GitHub
parent 0e106c9062
commit 02ea6028af
8 changed files with 77 additions and 69 deletions

View File

@@ -11,7 +11,7 @@ const (
fn test_with_deadline() {
dur := time.now().add(short_duration)
mut background := context.background()
mut ctx, cancel := context.with_deadline(mut &background, dur)
mut ctx, cancel := context.with_deadline(mut background, dur)
defer {
// Even though ctx will be expired, it is good practice to call its
@@ -35,7 +35,7 @@ fn test_with_timeout() {
// Pass a context with a timeout to tell a blocking function that it
// should abandon its work after the timeout elapses.
mut background := context.background()
mut ctx, cancel := context.with_timeout(mut &background, short_duration)
mut ctx, cancel := context.with_timeout(mut background, short_duration)
defer {
cancel()
}