summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorunknown <nick@mysql.com>2002-10-17 14:57:01 -0600
committerunknown <nick@mysql.com>2002-10-17 14:57:01 -0600
commita8bae6fe56482dbfc350b06a8cf3899fe5b38c01 (patch)
tree5ebc018564e0bd60dcd13b52589e89409cb617f5 /sql/sql_class.cc
parent95e9d1433118ae9544d0e3275529959a20c1feca (diff)
downloadmariadb-git-a8bae6fe56482dbfc350b06a8cf3899fe5b38c01.tar.gz
Moved rand initialization from mysqld.cc to sql_class.cc:THD::THD()
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 896bdec2913..fc64dfa13f9 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -37,6 +37,8 @@
#include <mysys_err.h>
#include <assert.h>
+extern struct rand_struct sql_rand;
+
/*****************************************************************************
** Instansiate templates
*****************************************************************************/
@@ -158,6 +160,18 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
transaction.trans_log.end_of_file= max_binlog_cache_size;
}
#endif
+
+ /*
+ We need good random number initialization for new thread
+ Just coping global one will not work
+ */
+ {
+ pthread_mutex_lock(&LOCK_thread_count);
+ ulong tmp=(ulong) (rnd(&sql_rand) * 3000000);
+ randominit(&rand, tmp + (ulong) start_time,
+ tmp + (ulong) thread_id);
+ pthread_mutex_unlock(&LOCK_thread_count);
+ }
}
/* Do operations that may take a long time */