| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
@pitrou @colesbury cc @rhettinger |
Sorry, something went wrong.
| int index = FT_ATOMIC_LOAD_INT(self->index); | ||
| if (index >= N) { /* generate N words at one time */ |
There was a problem hiding this comment.
I don't think this will work well. This can end up returning the same generated numbers to different threads, which we don't want.
Sorry, something went wrong.
There was a problem hiding this comment.
Hmm in that case, should we change the algorithm(thread-safe one) or fine-grained locking for this use case?
Sorry, something went wrong.
There was a problem hiding this comment.
I don't think there's a simple fix to the random module.
I commented on the issue. It'd be helpful to document the behavior and provide alternatives. For example, Java's java.util.Random includes the following comment:
Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs.
Sorry, something went wrong.
There was a problem hiding this comment.
I commented on the issue. It'd be helpful to document the behavior and provide alternatives. For example, Java's java.util.Random includes the following comment:
Okay sounds acceptable :)
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.