Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: common/data/rand/mathrand/impl.go

Issue 2588213002: Use global rand.Rand instance in mathrand. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | common/data/rand/mathrand/mathrand.go » ('j') | common/data/rand/mathrand/mathrand.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: common/data/rand/mathrand/impl.go
diff --git a/common/data/rand/mathrand/impl.go b/common/data/rand/mathrand/impl.go
index cb0cda4b6e1307d414e7984192cd469d12d66ff8..373e97f6514250903bc03ac9080959805f2c0f07 100644
--- a/common/data/rand/mathrand/impl.go
+++ b/common/data/rand/mathrand/impl.go
@@ -94,6 +94,10 @@ type Rand interface {
// for it. This can be used by callers to pull and use a *rand.Rand instance
// out of the Context safely.
//
+ // Other "mathrand" functions and objects MUST NOT BE USED inside the
+ // callback, as WithGoRand holds the lock to the current Rand instance, so any
+ // additional function call will deadlock.
+ //
// The callback's r must not be retained or used outside of hte scope of the
// callback.
WithGoRand(fn func(r *rand.Rand) error) error
« no previous file with comments | « no previous file | common/data/rand/mathrand/mathrand.go » ('j') | common/data/rand/mathrand/mathrand.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698