I think it is not about the context's cancellation. The signal channel
should have a sufficient buffer size.

Please check the former discussion which determined the Notify function's
description.
https://github.com/dominikh/go-staticcheck/issues/30

Best regards

On Mon, Jul 5, 2021 at 1:28 PM Sean Liao <seankhl...@gmail.com> wrote:

> What problem are you trying to solve?
> It only makes sense for NotifyContext to receive a single signal since a
> context can only be cancelled once
>
> On Monday, July 5, 2021 at 10:17:49 AM UTC+2 erma...@gmail.com wrote:
>
>> Sorry about the broken link, here is the line:
>>
>> https://github.com/golang/go/blob/912f0750472dd4f674b69ca1616bfaf377af1805/src/os/signal/signal.go#L284
>>
>> On Monday, July 5, 2021 at 11:15:11 AM UTC+3 erma...@gmail.com wrote:
>>
>>> Hello,
>>>
>>> I have an improvement idea for the following line in the os/signals
>>> package.
>>>
>>> 284 c.ch = make(chan os.Signal, 1)
>>>
>>> Regarding the underlying function's (Notify) description ("the caller
>>> must ensure that channel has sufficient buffer space to keep up with the
>>> expected signal rate.") the code can be improved like the following code
>>> snippet:
>>>
>>> cap := len(signals)
>>> if cap == 0 {
>>>     cap = 1
>>> }
>>> c.ch = make(chan os.Signal, cap)
>>>
>>> I wanted to discuss here first before opening my first issue :)
>>>
>>> Best regards
>>>
>>>
>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/PpUBZ1hxBbM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/c1cd6bd9-5307-4a71-9caa-f13c354185ccn%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/c1cd6bd9-5307-4a71-9caa-f13c354185ccn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
*Erman İmer*

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAAYkT3MhFw3nmx6Fduv0wRiy10uC1un3whkwYN%2BVNbJPvtApfA%40mail.gmail.com.

Reply via email to