Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(640)

Issue 4524083: code review 4524083: sync: wake up current goroutine on Cond.Signal if waiters=0 (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 11 months ago by niemeyer
Modified:
12 years, 11 months ago
Reviewers:
CC:
dvyukov, gustavo_niemeyer.net, rsc, golang-dev
Visibility:
Public.

Description

sync: always wake up previously sleeping goroutines on Cond.Signal This changes the internal implementation of Cond so that it uses two generations of waiters. This enables Signal to guarantee that it will only wake up waiters that are currently sleeping at the call time. Fixes issue 1648.

Patch Set 1 #

Patch Set 2 : code review 4524083: sync: wake up current goroutine on Cond.Signal if waiters=0 #

Patch Set 3 : diff -r b0c691bce96b https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r b0c691bce96b https://go.googlecode.com/hg/ #

Total comments: 3

Patch Set 5 : diff -r 824219c8f5c9 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+73 lines, -23 lines) Patch
M src/pkg/sync/cond.go View 1 2 3 4 4 chunks +46 lines, -23 lines 0 comments Download
M src/pkg/sync/cond_test.go View 1 2 1 chunk +27 lines, -0 lines 0 comments Download

Messages

Total messages: 11
niemeyer
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
12 years, 11 months ago (2011-05-31 13:33:02 UTC) #1
dvyukov
On 2011/05/31 13:33:02, niemeyer wrote: > Hello mailto:golang-dev@googlegroups.com (cc: mailto:golang-dev@googlegroups.com), > > I'd like you ...
12 years, 11 months ago (2011-05-31 13:49:12 UTC) #2
gustavo_niemeyer.net
> I don't think it's that simple. If there are 2 waiters, signal must wake ...
12 years, 11 months ago (2011-05-31 13:56:49 UTC) #3
gustavo_niemeyer.net
> It is that simple to fix the reported issue. If we want to make ...
12 years, 11 months ago (2011-05-31 14:27:41 UTC) #4
niemeyer
> Hmmm, I think I can increase the guarantees without creeping up the > design. ...
12 years, 11 months ago (2011-05-31 15:22:13 UTC) #5
dvyukov
On 2011/05/31 15:22:13, niemeyer wrote: > > Hmmm, I think I can increase the guarantees ...
12 years, 11 months ago (2011-06-01 15:05:48 UTC) #6
gustavo_niemeyer.net
> The algorithm looks good to me. I am pretty sure it's correct. I think ...
12 years, 11 months ago (2011-06-01 16:35:12 UTC) #7
dvyukov
On 2011/06/01 16:35:12, gustavo_niemeyer.net wrote: > > The algorithm looks good to me. I am ...
12 years, 11 months ago (2011-06-01 16:46:00 UTC) #8
niemeyer
> So LGTM on my side. Thanks. Russ/Rob, can one of you please have a ...
12 years, 11 months ago (2011-06-01 16:49:25 UTC) #9
rsc
LGTM Nice code. http://codereview.appspot.com/4524083/diff/5/src/pkg/sync/cond.go File src/pkg/sync/cond.go (right): http://codereview.appspot.com/4524083/diff/5/src/pkg/sync/cond.go#newcode19 src/pkg/sync/cond.go:19: oldwaiters int // number of goroutines ...
12 years, 11 months ago (2011-06-01 19:10:44 UTC) #10
niemeyer
12 years, 11 months ago (2011-06-01 23:30:54 UTC) #11
*** Submitted as http://code.google.com/p/go/source/detail?r=dc4142625e5f ***

sync: always wake up previously sleeping goroutines on Cond.Signal

This changes the internal implementation of Cond so that
it uses two generations of waiters.  This enables Signal
to guarantee that it will only wake up waiters that are
currently sleeping at the call time.

Fixes issue 1648.

R=dvyukov, gustavo, rsc
CC=golang-dev
http://codereview.appspot.com/4524083
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b