Commit 1a3b9b60 authored by Kirill Smelkov's avatar Kirill Smelkov

xcontext: Add note about how Merge could be done efficiently

Pygolang does it. However my comment on Go issue tracker about this
topic got no feedback at all:

https://github.com/golang/go/issues/30694#issuecomment-483820400
parent 79711643
// Copyright (C) 2017-2018 Nexedi SA and Contributors. // Copyright (C) 2017-2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com> // Kirill Smelkov <kirr@nexedi.com>
// //
// This program is free software: you can Use, Study, Modify and Redistribute // This program is free software: you can Use, Study, Modify and Redistribute
...@@ -55,6 +55,15 @@ import ( ...@@ -55,6 +55,15 @@ import (
"time" "time"
) )
// XXX if we could change std context, then Merge could work by simply creating
// cancelCtx and registering it to parent1 and parent2.
//
// For the reference: here is how it is done in pygolang:
//
// https://lab.nexedi.com/kirr/pygolang/blob/d3bfb1bf/golang/context.py#L115-130
// https://lab.nexedi.com/kirr/pygolang/blob/d3bfb1bf/golang/context.py#L228-264
// mergeCtx represents 2 context merged into 1. // mergeCtx represents 2 context merged into 1.
type mergeCtx struct { type mergeCtx struct {
parent1, parent2 context.Context parent1, parent2 context.Context
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment