mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
doc: update signal.Notify example to use buffered channel
This if follow up of CL 274332. Updates #9399. Change-Id: Ic6dd534dc18227a799cbb9577979f2285596b825 Reviewed-on: https://go-review.googlesource.com/c/go/+/274393 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
10240b9d6b
commit
5984ea7197
1 changed files with 2 additions and 2 deletions
|
|
@ -1647,14 +1647,14 @@ c := signal.Incoming()
|
||||||
is
|
is
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
c := make(chan os.Signal)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c) // ask for all signals
|
signal.Notify(c) // ask for all signals
|
||||||
</pre>
|
</pre>
|
||||||
<p>
|
<p>
|
||||||
but most code should list the specific signals it wants to handle instead:
|
but most code should list the specific signals it wants to handle instead:
|
||||||
</p>
|
</p>
|
||||||
<pre>
|
<pre>
|
||||||
c := make(chan os.Signal)
|
c := make(chan os.Signal, 1)
|
||||||
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
|
signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT)
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue