diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-06-06 22:37:27 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2014-06-06 22:37:27 +0000 |
commit | 6736ef96eab222e58e6294f42be981a5afb59811 (patch) | |
tree | 2bc668fae9bf96f9a3988e0b0a16685bde8c4f0b /libgo/go/runtime/lfstack_test.go | |
parent | 38a138411da4206c53f9a153ee9c3624fce58a52 (diff) | |
download | gcc-6736ef96eab222e58e6294f42be981a5afb59811.zip gcc-6736ef96eab222e58e6294f42be981a5afb59811.tar.gz gcc-6736ef96eab222e58e6294f42be981a5afb59811.tar.bz2 |
libgo: Merge to master revision 19184.
The next revision, 19185, renames several runtime files, and
will be handled in a separate change.
From-SVN: r211328
Diffstat (limited to 'libgo/go/runtime/lfstack_test.go')
-rw-r--r-- | libgo/go/runtime/lfstack_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libgo/go/runtime/lfstack_test.go b/libgo/go/runtime/lfstack_test.go index 505aae6..e518777 100644 --- a/libgo/go/runtime/lfstack_test.go +++ b/libgo/go/runtime/lfstack_test.go @@ -71,6 +71,8 @@ func TestLFStack(t *testing.T) { } } +var stress []*MyNode + func TestLFStackStress(t *testing.T) { const K = 100 P := 4 * GOMAXPROCS(-1) @@ -80,14 +82,15 @@ func TestLFStackStress(t *testing.T) { } // Create 2 stacks. stacks := [2]*uint64{new(uint64), new(uint64)} - // Need to keep additional referenfces to nodes, the stack is not all that type-safe. - var nodes []*MyNode + // Need to keep additional references to nodes, + // the lock-free stack is not type-safe. + stress = nil // Push K elements randomly onto the stacks. sum := 0 for i := 0; i < K; i++ { sum += i node := &MyNode{data: i} - nodes = append(nodes, node) + stress = append(stress, node) LFStackPush(stacks[i%2], fromMyNode(node)) } c := make(chan bool, P) @@ -127,4 +130,7 @@ func TestLFStackStress(t *testing.T) { if sum2 != sum { t.Fatalf("Wrong sum %d/%d", sum2, sum) } + + // Let nodes be collected now. + stress = nil } |