From 1a3b9b60f64bc341180a73d8a8095f7584bb8fab Mon Sep 17 00:00:00 2001 From: Kirill Smelkov <kirr@nexedi.com> Date: Sun, 19 May 2019 08:52:18 +0300 Subject: [PATCH] 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 --- xcontext/xcontext.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xcontext/xcontext.go b/xcontext/xcontext.go index 152fe00..11fa01c 100644 --- a/xcontext/xcontext.go +++ b/xcontext/xcontext.go @@ -1,4 +1,4 @@ -// Copyright (C) 2017-2018 Nexedi SA and Contributors. +// Copyright (C) 2017-2019 Nexedi SA and Contributors. // Kirill Smelkov <kirr@nexedi.com> // // This program is free software: you can Use, Study, Modify and Redistribute @@ -55,6 +55,15 @@ import ( "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. type mergeCtx struct { parent1, parent2 context.Context