You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The counters c3 and c4 share the same backing memory for the counter lvs slice. As a result, c4 will overwrite the contents of c3 lvs slice. So in the example above, at the end of the execution, c3 lvs internal slice has values: a 1 b 2 c 3 d 4 e 5 h 8 g 7
What did you expect?
The expectation I have is c3 lvs internal slice has values: a 1 b 2 c 3 d 4 e 5 f 6 g 7
I assumed it behaved a bit like context.WithValue which I think would have similar behavior in keeping the parent-child contexts free from overwrite.
What happened instead?
The c3 lvs internal slice has values: a 1 b 2 c 3 d 4 e 5 h 8 g 7 because c4 overwrote part of the c3 slice.
The text was updated successfully, but these errors were encountered:
What did you do?
I created a PR to demonstrate the problem:
#1295
To summarize, there are 4 counters:
The counters
c3
andc4
share the same backing memory for the counter lvs slice. As a result,c4
will overwrite the contents ofc3
lvs slice. So in the example above, at the end of the execution, c3 lvs internal slice has values:a 1 b 2 c 3 d 4 e 5 h 8 g 7
What did you expect?
The expectation I have is c3 lvs internal slice has values:
a 1 b 2 c 3 d 4 e 5 f 6 g 7
I assumed it behaved a bit like context.WithValue which I think would have similar behavior in keeping the parent-child contexts free from overwrite.
What happened instead?
The c3 lvs internal slice has values:
a 1 b 2 c 3 d 4 e 5 h 8 g 7
becausec4
overwrote part of thec3
slice.The text was updated successfully, but these errors were encountered: