mirror of
https://github.com/nginx/nginx.git
synced 2024-12-22 23:23:32 -06:00
Win32: added per-thread random seeding.
The change in b91bcba29351 was not enough to fix random() seeding. On Windows, the srand() seeds the PRNG only in the current thread, and worse, is not inherited from the calling thread. Due to this, worker threads were not properly seeded. Reported by Marc Bevand.
This commit is contained in:
parent
38ca99cf98
commit
e62a16e8f6
@ -764,6 +764,8 @@ ngx_worker_thread(void *data)
|
|||||||
ngx_int_t n;
|
ngx_int_t n;
|
||||||
ngx_cycle_t *cycle;
|
ngx_cycle_t *cycle;
|
||||||
|
|
||||||
|
srand((ngx_pid << 16) ^ (unsigned) ngx_time());
|
||||||
|
|
||||||
cycle = (ngx_cycle_t *) ngx_cycle;
|
cycle = (ngx_cycle_t *) ngx_cycle;
|
||||||
|
|
||||||
for (n = 0; cycle->modules[n]; n++) {
|
for (n = 0; cycle->modules[n]; n++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user