From c3b73be338553eeecce0611031c824688cc12108 Mon Sep 17 00:00:00 2001 From: RyougiNevermore Date: Thu, 26 Apr 2018 14:36:07 +0800 Subject: [PATCH 1/2] update test cases. --- array.go | 3 ++- array_buffer.go | 4 ++-- sequence.go | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/array.go b/array.go index c45245b..97d3439 100644 --- a/array.go +++ b/array.go @@ -6,7 +6,8 @@ import ( ) type entry struct { - value interface{} + value interface{} + padding [7]int64 } func newArray(capacity int64) (a *array) { diff --git a/array_buffer.go b/array_buffer.go index 45cf7da..bb775b2 100644 --- a/array_buffer.go +++ b/array_buffer.go @@ -51,7 +51,7 @@ func (b *arrayBuffer) Send(i interface{}) (err error) { b.wdSeq.Incr() break } - time.Sleep(500 * time.Microsecond) + time.Sleep(1 * time.Nanosecond) if times <= 0 { runtime.Gosched() times = 10 @@ -74,7 +74,7 @@ func (b *arrayBuffer) Recv() (value interface{}, active bool) { b.rdSeq.Incr() break } - time.Sleep(500 * time.Microsecond) + time.Sleep(1 * time.Nanosecond) if times <= 0 { runtime.Gosched() times = 10 diff --git a/sequence.go b/sequence.go index 77c9d58..41fa658 100644 --- a/sequence.go +++ b/sequence.go @@ -1,8 +1,9 @@ package flyline import ( - "runtime" "sync/atomic" + "runtime" + "time" ) // Sequence New Function, value starts from -1. @@ -29,6 +30,7 @@ func (s *Sequence) Incr() (value int64) { value = nextValue break } + time.Sleep(1 * time.Nanosecond) if times <= 0 { times = 10 runtime.Gosched() @@ -48,6 +50,7 @@ func (s *Sequence) Decr() (value int64) { value = preValue break } + time.Sleep(1 * time.Nanosecond) if times <= 0 { times = 10 runtime.Gosched() From 5de6cda3415b00bc6b6e73b2e799b6e756a0a37c Mon Sep 17 00:00:00 2001 From: RyougiNevermore Date: Sat, 28 Apr 2018 20:02:02 +0800 Subject: [PATCH 2/2] readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc42886..1d0434f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A flyline buffer works similar to a standard Go channel with the following featu ### Installing -To start using fastlane, install Go and run `go get`: +To start using flyline, install Go and run `go get`: ```sh $ go get github.com/pharosnet/flyline