Re: [Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-20 Thread Nicolai Hähnle
On 14.03.2017 03:08, Timothy Arceri wrote: Otherwise we will always remove old cache entries from the same dirs. Seeding the global RNG from within a driver is a no-no as others pointed out. I'd suggest you extract the xorshift128plus generator from r600_test_dma.c into a common utility and u

Re: [Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-15 Thread Grazvydas Ignotas
On Wed, Mar 15, 2017 at 8:47 PM, Bas Nieuwenhuizen wrote: > I thought rand() was not thread safe anyway, and hence we can't use it > in mesa as we don't know what application threads call it too? My manpage says "MT-Safe". > > On Tue, Mar 14, 2017 at 3:08 AM, Timothy Arceri wrote: >> Otherwise

Re: [Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-15 Thread Bas Nieuwenhuizen
I thought rand() was not thread safe anyway, and hence we can't use it in mesa as we don't know what application threads call it too? On Tue, Mar 14, 2017 at 3:08 AM, Timothy Arceri wrote: > Otherwise we will always remove old cache entries from the same dirs. > --- > src/util/disk_cache.c | 2 +

Re: [Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-15 Thread Alan Swanson
On Tue, 2017-03-14 at 12:34 +0200, Grazvydas Ignotas wrote: > It's not a good practice to srand() in libraries [1]. Not sure what > to > suggest though, maybe rand_r() but "POSIX.1-2008 marks rand_r() as > obsolete". Maybe somebody else (Emil?) has some ideas? > > [1] http://stackoverflow.com/ques

Re: [Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-14 Thread Grazvydas Ignotas
It's not a good practice to srand() in libraries [1]. Not sure what to suggest though, maybe rand_r() but "POSIX.1-2008 marks rand_r() as obsolete". Maybe somebody else (Emil?) has some ideas? [1] http://stackoverflow.com/questions/14883035/problems-of-using-srand-in-libraries Gražvydas On Tue

[Mesa-dev] [PATCH 1/5] util/disk_cache: seed rand

2017-03-13 Thread Timothy Arceri
Otherwise we will always remove old cache entries from the same dirs. --- src/util/disk_cache.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 2a1024a..dc65d52 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -402,20 +402,