[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] [PATCH] Make _init_rand() thread safe - use rand_r() instead of rand().



On Sat, 2008-12-06 at 13:58 +0000, Alasdair G Kergon wrote:
>  
> > > Does this patch do enough to ensure each thread will get a different value of
> > > 'seed'?
> > Probably not.  A better seed might use /dev/urandom or gettimeofday()
> > with tv_usec granularity.
>  
> Yup - the existing one-second granularity makes a collision likely - tv_usec
> ought to be adequate.
> 

Did not see this before I started adding the generic read_urandom()
function.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]