diff --git a/g/os/gmlock/gmlock_unit_lock_test.go b/g/os/gmlock/gmlock_unit_lock_test.go index 04665eed4..3e022b21c 100644 --- a/g/os/gmlock/gmlock_unit_lock_test.go +++ b/g/os/gmlock/gmlock_unit_lock_test.go @@ -16,7 +16,7 @@ import ( func TestLocker_Lock_Unlock(t *testing.T) { gtest.Case(t, func() { - array := garray.New(0, 0, true) + array := garray.New(0, 0) go func() { gmlock.Lock("test") array.Append(1) @@ -44,7 +44,7 @@ func TestLocker_Lock_Unlock(t *testing.T) { func TestLocker_Lock_Expire(t *testing.T) { gtest.Case(t, func() { - array := garray.New(0, 0, true) + array := garray.New(0, 0) go func() { gmlock.Lock("test", 50*time.Millisecond) array.Append(1) @@ -64,7 +64,7 @@ func TestLocker_Lock_Expire(t *testing.T) { func TestLocker_TryLock_Expire(t *testing.T) { gtest.Case(t, func() { - array := garray.New(0, 0, true) + array := garray.New(0, 0) go func() { gmlock.Lock("test", 200*time.Millisecond) array.Append(1) diff --git a/g/os/gmlock/gmlock_unit_rlock_test.go b/g/os/gmlock/gmlock_unit_rlock_test.go index aa0f8f3be..a5eb25615 100644 --- a/g/os/gmlock/gmlock_unit_rlock_test.go +++ b/g/os/gmlock/gmlock_unit_rlock_test.go @@ -16,7 +16,7 @@ import ( func TestLocker_RLock1(t *testing.T) { gtest.Case(t, func() { - array := garray.New(0, 0, true) + array := garray.New(0, 0) go func() { gmlock.RLock("test") array.Append(1) @@ -39,7 +39,7 @@ func TestLocker_RLock1(t *testing.T) { func TestLocker_RLock2(t *testing.T) { gtest.Case(t, func() { - array := garray.New(0, 0, true) + array := garray.New(0, 0) go func() { gmlock.Lock("test") array.Append(1) diff --git a/geg/os/gcron/gcron.go b/geg/os/gcron/gcron1.go similarity index 100% rename from geg/os/gcron/gcron.go rename to geg/os/gcron/gcron1.go diff --git a/geg/os/gcron/gcron2.go b/geg/os/gcron/gcron2.go new file mode 100644 index 000000000..2fb94b66e --- /dev/null +++ b/geg/os/gcron/gcron2.go @@ -0,0 +1,17 @@ +package main + +import ( + "gitee.com/johng/gf/g/os/gcron" + "gitee.com/johng/gf/g/os/glog" + "time" +) + +func main() { + cron := gcron.New() + glog.Println("start") + cron.DelayAddOnce(1, "* * * * * *", func() { + glog.Println("run") + }) + + time.Sleep(10*time.Second) +} \ No newline at end of file