lkml.org 
[lkml]   [2014]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH 0/5] arch: atomic rework
On Thu, Feb 20, 2014 at 12:30:32AM -0800, Paul E. McKenney wrote:
> On Wed, Feb 19, 2014 at 08:43:14PM -0800, Linus Torvalds wrote:

[ . . . ]

> So, if you make one of two changes to your example, then I will agree
> with you. The first change is to have a real data dependency between
> the read of "a" and the second read:
>
> - Initial state:
>
> a = &c, b = 0; c = 0;
>
> - Thread 1 ("consumer"):
>
> if (atomic_read(&a, consume))

And the above should be "if (atomic_read(&a, consume) != &c)". Sigh!!!

Thanx, Paul

> return *a;
> /* not yet initialized */
> return -1;
>
> - Thread 2 ("initializer"):
>
> b = some_value_lets_say_42;
> /* We are now ready to party */
> atomic_write(&a, &b, release);



\
 
 \ /
  Last update: 2014-02-20 11:41    [W:0.343 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site