github.com/PureWhiteWu/ppin@v0.0.0-20210222034823-197eac484787/ppin_test.go (about)

     1  package ppin
     2  
     3  import (
     4  	"runtime"
     5  	"sync"
     6  	"testing"
     7  )
     8  
     9  func TestPin(t *testing.T) {
    10  	n := Pin()
    11  	Unpin()
    12  	t.Log(n)
    13  	var wg sync.WaitGroup
    14  	for i := 0; i < runtime.GOMAXPROCS(0); i++ {
    15  		wg.Add(1)
    16  		go func() {
    17  			n := Pin()
    18  			Unpin()
    19  			t.Log(n)
    20  			wg.Done()
    21  		}()
    22  	}
    23  	wg.Wait()
    24  }