From 95c4c1f691b283b3b83ee1885b4eb996c939d6c1 Mon Sep 17 00:00:00 2001
From: Abhilash Gnan
Date: Sat, 14 Dec 2019 00:24:43 +0530
Subject: [PATCH] Add time.Sleep for timers
Signed-off-by: Abhilash Gnan
---
examples/timers/timers.go | 3 +++
examples/timers/timers.hash | 4 ++--
public/timers | 19 ++++++++++++++++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/examples/timers/timers.go b/examples/timers/timers.go
index d0256e6..d63c48f 100644
--- a/examples/timers/timers.go
+++ b/examples/timers/timers.go
@@ -38,4 +38,7 @@ func main() {
if stop2 {
fmt.Println("Timer 2 stopped")
}
+
+ // Give timer2 enough time if it has to expire.
+ time.Sleep(2)
}
diff --git a/examples/timers/timers.hash b/examples/timers/timers.hash
index 8c0f2c4..498375e 100644
--- a/examples/timers/timers.hash
+++ b/examples/timers/timers.hash
@@ -1,2 +1,2 @@
-e8e501d6083bea786629ca5e485e8b18caab4815
-pLnKEIesooU
+c7157df6604e894d7660af0a28442652e7bc2cd6
+969wzKNNiWA
diff --git a/public/timers b/public/timers
index 977afef..eec9efb 100644
--- a/public/timers
+++ b/public/timers
@@ -45,7 +45,7 @@ at tickers.
- 
+ 
@@ -119,7 +119,7 @@ that you can cancel the timer before it expires.
Here’s an example of that.
|
-
+ |
timer2 := time.NewTimer(time.Second)
go func() {
@@ -130,6 +130,19 @@ Here’s an example of that.
if stop2 {
fmt.Println("Timer 2 stopped")
}
+
+
+ |
+
+
+
+
+ Give timer2 enough time if it has to expire
+
+ |
+
+
+
@@ -170,7 +183,7 @@ a chance to expire.
|