3 // Copyright 2015 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Test that stack barriers are reset when a goroutine exits without
19 // Let the garbage collector run concurrently.
28 // Use enough stack to get stack barriers, but
29 // not so much that we go over _FixedStack.
30 // There's a very narrow window here on most
31 // OSs, so we basically can't do anything (not
32 // even a time.Sleep or a channel).
35 for atomic.LoadInt32(&done) == 0 {
38 atomic.StoreInt32(&done, 0)
39 // Exit without unwinding stack barriers.
43 // Generate some garbage.
44 x[i] = make([]byte, 1024*1024)
46 // Give GC some time to install stack barriers in the G.
47 time.Sleep(50 * time.Microsecond)
48 atomic.StoreInt32(&done, 1)
49 for atomic.LoadInt32(&done) == 1 {