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

vlib/net: add buffered IO, x.net -> net (#6754)

This commit is contained in:
Emily Hudson
2020-11-15 20:54:47 +00:00
committed by GitHub
parent 20bec81678
commit cd2a2cef25
55 changed files with 741 additions and 1648 deletions

23
examples/net_t.v Normal file
View File

@@ -0,0 +1,23 @@
import net.http
import sync
import time
fn send_request(mut wg sync.WaitGroup) ?string {
start := time.ticks()
data := http.get('https://google.com')?
finish := time.ticks()
println('Finish getting time ${finish - start} ms')
wg.done()
return data.text
}
fn main() {
mut wg := sync.new_waitgroup()
for i := 0; i < 50; i++ {
wg.add(1)
go send_request(mut wg)
}
wg.wait()
}