Skip to content

Commit 17278f8

Browse files
committed
✨ New Method Get with non-blocking behaviour
1 parent 415fca6 commit 17278f8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scontrol.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,14 @@ func (c *Controller) Check() Status {
5050
c.wg.Wait() // if Status is not Pause, it will return immediately
5151
c.locker.RLock()
5252
defer c.locker.RUnlock()
53-
return c.s
53+
tmp := c.s
54+
return tmp
55+
}
56+
57+
// Get return status immediately; no blocking.
58+
func (c *Controller) Get() Status {
59+
c.locker.RLock()
60+
defer c.locker.RUnlock()
61+
tmp := c.s
62+
return tmp
5463
}

0 commit comments

Comments
 (0)