Commit 53ab2891 authored by 张振华's avatar 张振华

update

parent 903932bc
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"os" "os"
"os/signal" "os/signal"
"strings" "strings"
"sync"
"testing" "testing"
"time" "time"
) )
...@@ -91,13 +92,20 @@ func TestKill(t *testing.T) { ...@@ -91,13 +92,20 @@ func TestKill(t *testing.T) {
var ( var (
goIndex = 0 goIndex = 0
goIndexMutex sync.Mutex
goSum = 0 goSum = 0
goSumMutex sync.Mutex
) )
func test() { func test() {
goIndexMutex.Lock()
goIndex++ goIndex++
goIndexMutex.Unlock()
time.Sleep(time.Second * time.Duration(goIndex)) time.Sleep(time.Second * time.Duration(goIndex))
goSumMutex.Lock()
goSum++ goSum++
goSumMutex.Unlock()
} }
func TestParallel(t *testing.T) { func TestParallel(t *testing.T) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment