On Thu, Jan 26, 2012 at 08:39:07AM -0500, John Baldwin wrote:
> What is the purpose of the atomics?  Doing atomic_load/atomic_store
> is just as racy as if you had not used atomics at all.  

Thanx for a hint.
Protecting comparison itself isn't essential as protecting variable 
consitency because random_yarrow_unblock() which triggers operation isn't 
called concurrently, but arc4rand() is. I consider your suggested way 
a bit later. Yes, it seems acq/rel memory barriers are unneded,

> Should you be
> using atomic_cmpset instead, e.g.:
> 
>       case ARC4_ENTER_HAVE:
>               /* XXX: What does it mean for this to fail? */

It means "Request to have enough entropy, but already have or even already 
reseed".

>               atomic_cmpset_int(&iniseed_state, ARC4_ENTER_NONE, 
> ARC4_ENTER_HAVE);
>               break;

-- 
http://ache.vniz.net/
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to