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

Dave Wysochanski dwysocha at redhat.com
Sat Dec 6 16:16:06 UTC 2008


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.




More information about the lvm-devel mailing list