On Wednesday, January 25, 2012 10:39:50 pm Andrey Chernov wrote: > On Thu, Jan 26, 2012 at 07:03:05AM +0400, Andrey Chernov wrote: > > On Wed, Jan 25, 2012 at 07:16:41PM +0000, Mark Murray wrote: > > > I thought you were going to do this as a function? It would be > > > slightly neater to do it that way. > > > > > > Looks good! Are you sure this needs no locking or volatile > > > variables? > > > > Now with function, volatile, atomic and even enum: > > Sorry. Reading of state variable should be atomical too. Fixed version:
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. Should you be using atomic_cmpset instead, e.g.: case ARC4_ENTER_HAVE: /* XXX: What does it mean for this to fail? */ atomic_cmpset_int(&iniseed_state, ARC4_ENTER_NONE, ARC4_ENTER_HAVE); break; -- John Baldwin _______________________________________________ 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"