mirror of
https://github.com/MariaDB/server.git
synced 2026-05-09 08:34:28 +02:00
Moved rand initialization from mysqld.cc to sql_class.cc:THD::THD()
This commit is contained in:
parent
f4a3b1d903
commit
171ac60fe1
2 changed files with 15 additions and 10 deletions
|
|
@ -37,6 +37,8 @@
|
|||
#include <mysys_err.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern struct rand_struct sql_rand;
|
||||
|
||||
/*****************************************************************************
|
||||
** Instansiate templates
|
||||
*****************************************************************************/
|
||||
|
|
@ -172,6 +174,18 @@ THD::THD():user_time(0), fatal_error(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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue