Skip to content

Commit

Permalink
xcontext: Add note about how Merge could be done efficiently
Browse files Browse the repository at this point in the history
Pygolang does it. However my comment on Go issue tracker about this
topic got no feedback at all:

golang/go#30694 (comment)
  • Loading branch information
navytux committed May 19, 2019
1 parent 7971164 commit 1a3b9b6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion xcontext/xcontext.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1a3b9b6

Please sign in to comment.