> Don't we want to explicitly say that spurious wakeups are all allowed for
> sync.Cond?
How hard would it be to make the Go primitives not need this? I don't
know of any situation where a programmer wants a spurious wakeup; they
are an implementation artifact exposed to users.
Dave.
I think it's worth pointing out (as I did previously), that this
implementation artifact is not, in fact, exposed to users in any go
implementation that uses sync.Cond from the standard library. It's built on
Semacquire, which does not permit spurious interrupts.
Since we don't /have/ spurious wakeups, I rather think that's something to
flaunt, and definitely not hide.
--
Scott Lawrence
Note that this doesn't mean one should never put a loop around Wait;
if you're waiting on a var become a particular value, and the thing
changing that var does a Broadcast after changing it to a number of
different values, you still obviously want to loop until the var
becomes the specific value you want. But, in the simplest case of a
latch mechanism, spurious wakeups are just a nuisance.
Dave.
Maybe it should be explicitly documented that spurious wakeups won't
occur, then. Programmers coming from other systems may assume that
they do.
Dave.
The Cond.Wait comment does point out that you need to use a loop.
Maybe it should be explicitly documented that spurious wakeups won't>> > Don't we want to explicitly say that spurious wakeups are all allowed
>> > for
>> > sync.Cond?
>>
>> How hard would it be to make the Go primitives not need this? I don't
>> know of any situation where a programmer wants a spurious wakeup; they
>> are an implementation artifact exposed to users.
>
>
> I think the current implementation does not produce spurious wakeups. So we
> can leave the docs as is, if it is deliberate.
occur, then. Programmers coming from other systems may assume that
they do.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-dev/Kc1nOjju3zk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.