This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/branch-1.11 by this push:
new 9800460 AVRO-2722 Move the 'random' variable to be local to the
method where it is being used
9800460 is described below
commit 980046077dda2d0192d101178af87ca510578b2a
Author: Martin Tzvetanov Grigorov <[email protected]>
AuthorDate: Wed Oct 13 10:54:46 2021 +0300
AVRO-2722 Move the 'random' variable to be local to the method where it is
being used
This avoids thread-safety issues.
(cherry picked from commit a906d79b5bd15d7a773b54b06bdc0ffb308cca6b)
---
lang/c++/impl/DataFile.cc | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lang/c++/impl/DataFile.cc b/lang/c++/impl/DataFile.cc
index 18fb3f6..b0c5746 100644
--- a/lang/c++/impl/DataFile.cc
+++ b/lang/c++/impl/DataFile.cc
@@ -232,9 +232,8 @@ void DataFileWriterBase::flush() {
sync();
}
-boost::mt19937 random(static_cast<uint32_t>(time(nullptr)));
-
DataFileSync DataFileWriterBase::makeSync() {
+ boost::mt19937 random(static_cast<uint32_t>(time(nullptr)));
DataFileSync sync;
std::generate(sync.begin(), sync.end(), random);
return sync;