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

fmt: replace go with spawn

This commit is contained in:
Alexander Medvednikov
2022-11-05 10:46:40 +03:00
parent a082328e40
commit e81e0ac708
126 changed files with 262 additions and 262 deletions

View File

@@ -141,7 +141,7 @@ fn propagate_cancel(mut parent Context, mut child Canceler) {
}
}
mut p := parent_cancel_context(mut parent) or {
go fn (mut parent Context, mut child Canceler) {
spawn fn (mut parent Context, mut child Canceler) {
pdone := parent.done()
select {
_ := <-pdone {

View File

@@ -13,7 +13,7 @@ fn test_with_cancel() {
// the internal routine started by gen.
gen := fn (mut ctx context.Context) chan int {
dst := chan int{}
go fn (mut ctx context.Context, dst chan int) {
spawn fn (mut ctx context.Context, dst chan int) {
mut v := 0
ch := ctx.done()
for {

View File

@@ -51,7 +51,7 @@ pub fn with_deadline(mut parent Context, d time.Time) (Context, CancelFn) {
}
if ctx.err() is none {
go fn (mut ctx TimerContext, dur time.Duration) {
spawn fn (mut ctx TimerContext, dur time.Duration) {
time.sleep(dur)
ctx.cancel(true, deadline_exceeded)
}(mut ctx, dur)

View File

@@ -30,7 +30,7 @@ pub fn merge(ctx context.Context, ctxs ...context.Context) (context.Context, con
cancel_fn: cancel
cancel_ctx: cancel_ctx
}
go octx.run()
spawn octx.run()
return context.Context(octx), context.CancelFn(cancel)
}
@@ -112,7 +112,7 @@ pub fn (mut octx OneContext) cancel(err IError) {
}
pub fn (mut octx OneContext) run_two_contexts(mut ctx1 context.Context, mut ctx2 context.Context) {
go fn (mut octx OneContext, mut ctx1 context.Context, mut ctx2 context.Context) {
spawn fn (mut octx OneContext, mut ctx1 context.Context, mut ctx2 context.Context) {
octx_cancel_done := octx.cancel_ctx.done()
c1done := ctx1.done()
c2done := ctx2.done()
@@ -131,7 +131,7 @@ pub fn (mut octx OneContext) run_two_contexts(mut ctx1 context.Context, mut ctx2
}
pub fn (mut octx OneContext) run_multiple_contexts(mut ctx context.Context) {
go fn (mut octx OneContext, mut ctx context.Context) {
spawn fn (mut octx OneContext, mut ctx context.Context) {
octx_cancel_done := octx.cancel_ctx.done()
cdone := ctx.done()
select {