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

vlib/context: add onecontext as submodule (#12549)

This commit is contained in:
Ulises Jeremias Cornejo Fandos
2021-12-02 06:15:07 -03:00
committed by GitHub
parent 2144471ce1
commit f7926ec9a4
6 changed files with 369 additions and 3 deletions

View File

@@ -51,9 +51,10 @@ mut:
pub fn with_cancel(mut parent Context) (Context, CancelFn) {
mut c := new_cancel_context(parent)
propagate_cancel(mut parent, mut c)
return Context(c), fn [mut c] () {
cancel_fn := fn [mut c] () {
c.cancel(true, canceled)
}
return Context(c), CancelFn(cancel_fn)
}
// new_cancel_context returns an initialized CancelContext.