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

Unified Diff: src/pkg/exp/draw/x11/conn.go

Issue 4079053: code review 4079053: replace non-blocking send, receive syntax with select (Closed)
Patch Set: code review 4079053: replace non-blocking send, receive syntax with select Created 14 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/compress/flate/deflate_test.go ('k') | src/pkg/fmt/print.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/exp/draw/x11/conn.go
===================================================================
--- a/src/pkg/exp/draw/x11/conn.go
+++ b/src/pkg/exp/draw/x11/conn.go
@@ -122,10 +122,13 @@
func (c *conn) Screen() draw.Image { return c.img }
func (c *conn) FlushImage() {
- // We do the send (the <- operator) in an expression context, rather than in
- // a statement context, so that it does not block, and fails if the buffered
- // channel is full (in which case there already is a flush request pending).
- _ = c.flush <- false
+ select {
+ case c.flush <- false:
+ // Flush notification sent.
+ default:
+ // Could not send.
+ // Flush notification must be pending already.
+ }
}
func (c *conn) Close() os.Error {
« no previous file with comments | « src/pkg/compress/flate/deflate_test.go ('k') | src/pkg/fmt/print.go » ('j') | no next file with comments »

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